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