3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array( array( 'DeviceName' => 'Device1', 'DeviceId' => '', 'state' => 0 ), array( 'DeviceName' => 'Device2', 'DeviceId' => '', 'state' => 1 ), array( 'DeviceName' => 'Device3', 'DeviceId' => '', 'state' => 0 ), ); foreach ($array as $subarray) { foreach($subarray as $row) { if ($row['DeviceName'] == 'Device2') { echo $row['state']; } } }
based on JTDbk
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22 Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22 Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Warning: Illegal string offset 'DeviceName' in /in/vtkSR on line 22 Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22
Output for hhvm-3.15.4
Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22 Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22 Notice: Uninitialized string offset: 0 in /in/vtkSR on line 22