@ 2013-08-13T15:16:23Z <?php
<?php
class Foo
{
public $bar = 'barValue';
protected $baz = 'bazValue';
private $biz = 'bizValue';
}
$foo = new Foo();
$arrayFoo = (array) $foo;
$out = var_export($arrayFoo, true);
$out = preg_replace('/\'\' . "\\\0\" . \'[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\' . "\\\0\" . /', '', $out);
$newArray = unvar_dump($out);
var_dump($newArray);
function unvar_dump($str) {
if (strpos($str, "\n") === false) {
//Add new lines:
$regex = array(
'#(\\[.*?\\]=>)#',
'#(string\\(|int\\(|float\\(|array\\(|NULL|object\\(|})#',
);
$str = preg_replace($regex, "\n\\1", $str);
$str = trim($str);
}
$regex = array(
'#^\\040*NULL\\040*$#m',
'#^\\s*array\\((.*?)\\)\\s*{\\s*$#m',
'#^\\s*string\\((.*?)\\)\\s*(.*?)$#m',
'#^\\s*int\\((.*?)\\)\\s*$#m',
'#^\\s*float\\((.*?)\\)\\s*$#m',
'#^\\s*\[(\\d+)\\]\\s*=>\\s*$#m',
'#\\s*?\\r?\\n\\s*#m',
);
$replace = array(
'N',
'a:\\1:{',
's:\\1:\\2',
'i:\\1',
'd:\\1',
'i:\\1',
';'
);
$serialized = preg_replace($regex, $replace, $str);
$func = create_function(
'$match',
'return "s:".strlen($match[1]).":\\"".$match[1]."\\"";'
);
$serialized = preg_replace_callback(
'#\\s*\\["(.*?)"\\]\\s*=>#',
$func,
$serialized
);
$func = create_function(
'$match',
'return "O:".strlen($match[1]).":\\"".$match[1]."\\":".$match[2].":{";'
);
$serialized = preg_replace_callback(
'#object\\((.*?)\\).*?\\((\\d+)\\)\\s*{\\s*;#',
$func,
$serialized
);
$serialized = preg_replace(
array('#};#', '#{;#'),
array('}', '{'),
$serialized
);
return unserialize($serialized);
}
//"a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff";
// '' . "\0" . '*' . "\0" .
//echo $out . PHP_EOL;
//$b = serialize(array('bar' => 'barValue', 'baz' => 'bazValue', 'biz' => 'bizValue'));
//echo $b . PHP_EOL;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.17 0.011 0.038 12.38 5.4.16 0.010 0.039 12.38 5.4.15 0.012 0.036 12.37 5.4.14 0.011 0.038 12.06 5.4.13 0.008 0.040 12.04 5.4.12 0.012 0.034 12.01 5.4.11 0.009 0.038 12.00 5.4.10 0.009 0.039 12.01 5.4.9 0.010 0.039 12.00 5.4.8 0.009 0.040 12.00 5.4.7 0.008 0.039 12.00 5.4.6 0.012 0.040 12.00 5.4.5 0.011 0.041 12.00 5.4.4 0.011 0.041 11.99 5.4.3 0.009 0.040 11.98 5.4.2 0.009 0.038 11.98 5.4.1 0.010 0.036 11.98 5.4.0 0.009 0.038 11.48 5.3.27 0.012 0.042 12.72 5.3.26 0.009 0.045 12.72 5.3.25 0.011 0.039 12.72 5.3.24 0.009 0.041 12.72 5.3.23 0.011 0.040 12.71 5.3.22 0.008 0.043 12.68 5.3.21 0.010 0.040 12.68 5.3.20 0.009 0.042 12.68 5.3.19 0.010 0.041 12.67 5.3.18 0.011 0.038 12.67 5.3.17 0.011 0.039 12.67 5.3.16 0.008 0.042 12.67 5.3.15 0.009 0.042 12.68 5.3.14 0.010 0.040 12.66 5.3.13 0.010 0.045 12.66 5.3.12 0.012 0.040 12.66 5.3.11 0.008 0.043 12.66 5.3.10 0.011 0.042 12.12 5.3.9 0.012 0.044 12.08 5.3.8 0.010 0.040 12.08 5.3.7 0.009 0.040 12.08 5.3.6 0.007 0.042 12.06 5.3.5 0.010 0.039 12.00 5.3.4 0.012 0.038 12.00 5.3.3 0.011 0.041 11.95 5.3.2 0.009 0.044 11.73 5.3.1 0.010 0.040 11.69 5.3.0 0.009 0.043 11.68
preferences:dark mode live preview
140.2 ms | 1399 KiB | 7 Q