3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $result = [ array( 'id' => '183970', 'player1' => 'Weird', 'player2' => 'Bloodbuddy', 'player1_items' => '644:204,10:200000,', 'player2_items' => '38:200,', ), array ( 'id' => '183969', 'player1' => 'Frog', 'player2' => 'Eh', 'player1_items' => '656:1,11:3797,33:1111,42:200,40:100,31:1111,1263:1,522:1,', 'player2_items' => '405:1,', )]; foreach ($result as $item) { print "Player: {$item["player1"]}\n"; foreach (explode(',', $item['player1_items']) as $player1_item) { if(empty($player1_item)) continue; [$type, $qty] = explode(":", $player1_item); print "$type: $qty\n"; } }
Output for 7.1.0 - 7.3.0rc3
Player: Weird 644: 204 10: 200000 Player: Frog 656: 1 11: 3797 33: 1111 42: 200 40: 100 31: 1111 1263: 1 522: 1
Output for 5.6.30, 7.0.28 - 7.0.31
Parse error: syntax error, unexpected '=' in /in/Vuqpu on line 11
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: syntax error, unexpected '=' in /in/Vuqpu:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: syntax error, unexpected '=' in /in/Vuqpu:11 Stack trace: #0 {main}
Process exited with code 255.