<?php
$x = get_object_vars(json_decode('{"2":1}'));
$y = (object)$x;
$exprs = [isset($x[2])', 'isset($x["2"])', 'isset($y->{2})', 'isset($y->{"2"})', '$x', '$y'];
var_dump(array_map(function ($expr) use ($x, $y) {
return eval("return $expr;");
}, array_combine($exprs, $exprs)));
- Output for 7.0.0 - 7.0.18, 7.1.0 - 7.1.4
- Parse error: syntax error, unexpected '', '' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /in/ijU2D on line 6
Process exited with code 255.
preferences:
162.13 ms | 1395 KiB | 31 Q