@ 2017-03-31T07:59:47Z <?php
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*bool\\(true\\)\\s*$#m',
'#^\\s*bool\\(false\\)\\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',
'b:1',
'b:0',
'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);
}
$vardump = 'array(2) {
[0]=>
array(4) {
["username"]=>
string(3) "Ann"
["email"]=>
string(15) "ann89@gmail.com"
["first_name"]=>
string(3) "Ann"
["last_name"]=>
string(5) "Quike"
}
[1]=>
array(4) {
["username"]=>
string(7) "Stephan"
["email"]=>
string(15) "steve@gmail.com"
["first_name"]=>
string(7) "Stephan"
["last_name"]=>
string(4) "Qoin"
}
}';
$result = unvar_dump($vardump);
var_dump($result[0]);
var_dump($result[1]);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 Fatal error: Uncaught Error: Call to undefined function create_function() in /in/uJeEW:36
Stack trace:
#0 /in/uJeEW(88): unvar_dump('array(2) {\n[0]=...')
#1 {main}
thrown in /in/uJeEW on line 36
Process exited with code 255 . Output for 7.2.0 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.33 Deprecated: Function create_function() is deprecated in /in/uJeEW on line 38
Deprecated: Function create_function() is deprecated in /in/uJeEW on line 47
array(4) {
["username"]=>
string(3) "Ann"
["email"]=>
string(15) "ann89@gmail.com"
["first_name"]=>
string(3) "Ann"
["last_name"]=>
string(5) "Quike"
}
array(4) {
["username"]=>
string(7) "Stephan"
["email"]=>
string(15) "steve@gmail.com"
["first_name"]=>
string(7) "Stephan"
["last_name"]=>
string(4) "Qoin"
}
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.3.32 - 7.3.33 array(4) {
["username"]=>
string(3) "Ann"
["email"]=>
string(15) "ann89@gmail.com"
["first_name"]=>
string(3) "Ann"
["last_name"]=>
string(5) "Quike"
}
array(4) {
["username"]=>
string(7) "Stephan"
["email"]=>
string(15) "steve@gmail.com"
["first_name"]=>
string(7) "Stephan"
["last_name"]=>
string(4) "Qoin"
}
preferences:dark mode live preview
203.07 ms | 406 KiB | 182 Q