mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-21 22:17:41 +01:00
Str_replace replaces every occurence
This commit is contained in:
parent
584492f5f4
commit
2d4bc8805a
16
src/Sws.php
16
src/Sws.php
@ -290,17 +290,24 @@ class Sws
|
|||||||
private static function ReadHexData(String $data)
|
private static function ReadHexData(String $data)
|
||||||
{
|
{
|
||||||
$hex = implode(unpack("H*", $data));
|
$hex = implode(unpack("H*", $data));
|
||||||
$hex = implode(array_reverse(str_split($hex, 2)));
|
$hex = array_reverse(str_split($hex, 2));
|
||||||
$hex = str_replace("00", "", $hex);
|
|
||||||
|
foreach ($hex as $key=>$item) {
|
||||||
|
if ($item == "00") {
|
||||||
|
$hex[$key] = "";
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hex = implode($hex);
|
||||||
return $hex;
|
return $hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function UIntToTimestamp($date)
|
private static function UIntToTimestamp($date)
|
||||||
{
|
{
|
||||||
//echo $date;
|
|
||||||
$curyear = date('Y');
|
$curyear = date('Y');
|
||||||
$yearoffset = $curyear - self::PT_PASTOFFSET;
|
$yearoffset = $curyear - self::PT_PASTOFFSET;
|
||||||
//$yearoffset = 100;
|
|
||||||
|
|
||||||
// Day
|
// Day
|
||||||
$day = $date % self::PT_DAYFACTOR;
|
$day = $date % self::PT_DAYFACTOR;
|
||||||
@ -320,7 +327,6 @@ class Sws
|
|||||||
$concat = $month . '/' . $day . '/' . intval($year);
|
$concat = $month . '/' . $day . '/' . intval($year);
|
||||||
$format = 'm/d/Y';
|
$format = 'm/d/Y';
|
||||||
|
|
||||||
echo $concat;
|
|
||||||
|
|
||||||
return \DateTime::createFromFormat($format, $concat);
|
return \DateTime::createFromFormat($format, $concat);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user