3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sugar_unserialize($value) { preg_match('/[oc]:\d+:/i', $value, $matches); if (count($matches)) { return false; } return unserialize($value); } $test1 = 'O:8:"stdClass":0:{}'; $test2 = 'O:+8:"stdClass":0:{}'; var_dump(sugar_unserialize($test1), sugar_unserialize($test2));

preferences:
64.08 ms | 406 KiB | 5 Q