3v4l.org

run code in 300+ PHP versions simultaneously
<?php $paths = array( 'one' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'two' => array(1 => bus), 'three' => array(5 => subway), 'fow' => array(10 => bus), ) ), 'two' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'one' => array(1 => bus), ) ), 'three' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'one' => array(5 => bus), 'six' => array(20 => foot) ) ), 'fow' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'one' => array(10 => bus), 'five' => array(5 => bus) ) ), 'five' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'fow' => array(5 => bus), 'six' => array(5 => foot) ) ), 'six' => array( 'visited' => false, 'shortest_path' => INF, 'neighbors' => array( 'three' => array(20 => bus), 'five' => array(5 => foot) ) ) ); $array = array ( 0 => 'two ', 1 => 'three ', 2 => 'fow ', 3 => 'five ', 4 => 'six ', 5 => 'six ', ); // sort ДЛЯ СОРТИРОВКИ foreach ($array as $key => $name) { echo $name."\n"; if (count($paths[$name][neighbors]) >=2 ) { echo 123; foreach ($paths[$name][neighbors] as $neighbor) { if ($array[$key+1] == $neighbor) { echo $name; } } } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "bus" in /in/3b26v:8 Stack trace: #0 {main} thrown in /in/3b26v on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 8 Warning: Use of undefined constant subway - assumed 'subway' (this will throw an Error in a future version of PHP) in /in/3b26v on line 9 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 10 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 18 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 26 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 27 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 35 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 36 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 44 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 45 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 53 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 54 two Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: two in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 three Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: three in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 fow Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: fow in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 five Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: five in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76 Notice: Trying to access array offset on value of type null in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 8 Warning: Use of undefined constant subway - assumed 'subway' (this will throw an Error in a future version of PHP) in /in/3b26v on line 9 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 10 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 18 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 26 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 27 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 35 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 36 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 44 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 45 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 53 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 54 two Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 three Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 fow Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 five Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31
Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 8 Warning: Use of undefined constant subway - assumed 'subway' (this will throw an Error in a future version of PHP) in /in/3b26v on line 9 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 10 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 18 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 26 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 27 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 35 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 36 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 44 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 45 Warning: Use of undefined constant bus - assumed 'bus' (this will throw an Error in a future version of PHP) in /in/3b26v on line 53 Warning: Use of undefined constant foot - assumed 'foot' (this will throw an Error in a future version of PHP) in /in/3b26v on line 54 two Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: two in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 three Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: three in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 fow Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: fow in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 five Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: five in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76 six Warning: Use of undefined constant neighbors - assumed 'neighbors' (this will throw an Error in a future version of PHP) in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76 Warning: count(): Parameter must be an array or an object that implements Countable in /in/3b26v on line 76
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 8 Notice: Use of undefined constant subway - assumed 'subway' in /in/3b26v on line 9 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 10 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 18 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 26 Notice: Use of undefined constant foot - assumed 'foot' in /in/3b26v on line 27 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 35 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 36 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 44 Notice: Use of undefined constant foot - assumed 'foot' in /in/3b26v on line 45 Notice: Use of undefined constant bus - assumed 'bus' in /in/3b26v on line 53 Notice: Use of undefined constant foot - assumed 'foot' in /in/3b26v on line 54 two Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: two in /in/3b26v on line 76 three Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: three in /in/3b26v on line 76 fow Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: fow in /in/3b26v on line 76 five Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: five in /in/3b26v on line 76 six Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76 six Notice: Use of undefined constant neighbors - assumed 'neighbors' in /in/3b26v on line 76 Notice: Undefined index: six in /in/3b26v on line 76

preferences:
186.45 ms | 406 KiB | 174 Q