@ 2013-06-13T11:00:22Z <?php
function mb_unserialize($string) {
$string = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $string);
return unserialize($string);
}
$string = <<<HERE
a:1:{i:0;a:15:{s:2:"ID";s:3:"157";s:3:"qty";i:1;s:4:"name";s:21:"?????\?????";s:6:"nameHe";s:21:"?????\?????";s:6:"nameEn";s:21:"?????\?????";s:5:"price";d:80;s:8:"priceNet";d:80;s:10:"priceGross";d:96.7999999999999971578290569595992565155029296875;s:3:"sum";d:80;s:6:"sumNet";d:80;s:8:"sumGross";d:96.7999999999999971578290569595992565155029296875;s:7:"vatRate";d:21;s:3:"vat";d:16.800000000000000710542735760100185871124267578125;s:6:"vatSum";d:16.800000000000000710542735760100185871124267578125;s:4:"hash";s:40:"94d8e389a9617f0adc2cfedb6e0e102155f4ec2f";}}
HERE;
var_dump(mb_unserialize($string));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/nZ7rF on line 3
Deprecated: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in /in/nZ7rF on line 4
bool(false)
Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/nZ7rF on line 3
bool(false)
Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/nZ7rF on line 3
array(1) {
[0]=>
array(15) {
["ID"]=>
string(3) "157"
["qty"]=>
int(1)
["name"]=>
string(11) "?????\?????"
["nameHe"]=>
string(11) "?????\?????"
["nameEn"]=>
string(11) "?????\?????"
["price"]=>
float(80)
["priceNet"]=>
float(80)
["priceGross"]=>
float(96.8)
["sum"]=>
float(80)
["sumNet"]=>
float(80)
["sumGross"]=>
float(96.8)
["vatRate"]=>
float(21)
["vat"]=>
float(16.8)
["vatSum"]=>
float(16.8)
["hash"]=>
string(40) "94d8e389a9617f0adc2cfedb6e0e102155f4ec2f"
}
}
Output for 4.3.0 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 array(1) {
[0]=>
array(15) {
["ID"]=>
string(3) "157"
["qty"]=>
int(1)
["name"]=>
string(11) "?????\?????"
["nameHe"]=>
string(11) "?????\?????"
["nameEn"]=>
string(11) "?????\?????"
["price"]=>
float(80)
["priceNet"]=>
float(80)
["priceGross"]=>
float(96.8)
["sum"]=>
float(80)
["sumNet"]=>
float(80)
["sumGross"]=>
float(96.8)
["vatRate"]=>
float(21)
["vat"]=>
float(16.8)
["vatSum"]=>
float(16.8)
["hash"]=>
string(40) "94d8e389a9617f0adc2cfedb6e0e102155f4ec2f"
}
}
preferences:dark mode live preview
261.99 ms | 404 KiB | 460 Q