3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{"name":null,"value":"","target":null,"alias":"brand","required":1,"showNull":0}]'; var_export(json_decode($json)); echo "\n---\n"; foreach (json_decode($json ?? '[]') as $row) { if ($row->alias === 'brand') { echo $row->value; break; } }
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.29, 8.0.0 - 8.0.19, 8.1.0 - 8.1.6
array ( 0 => (object) array( 'name' => NULL, 'value' => '', 'target' => NULL, 'alias' => 'brand', 'required' => 1, 'showNull' => 0, ), ) ---
Output for 7.2.0 - 7.2.33
array ( 0 => stdClass::__set_state(array( 'name' => NULL, 'value' => '', 'target' => NULL, 'alias' => 'brand', 'required' => 1, 'showNull' => 0, )), ) ---

preferences:
78.32 ms | 410 KiB | 5 Q