3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json_object = '[ { "username": "test_username", "character": "TEST", "position": "6", "current_turn": false, "cards": [], "winning_cards": [] }, { "username": "test_username2", "character": "TEST2", "position": "7", "current_turn": false, "cards": [], "winning_cards": [] } ]'; $data = json_decode($json_object,true); foreach($data as $key=>$value) { $data[$key]['winning_cards'] = [1,2,3]; } $json_object = json_encode($data,JSON_PRETTY_PRINT); echo $json_object; ?>
Output for git.master, git.master_jit, rfc.property-hooks
[ { "username": "test_username", "character": "TEST", "position": "6", "current_turn": false, "cards": [], "winning_cards": [ 1, 2, 3 ] }, { "username": "test_username2", "character": "TEST2", "position": "7", "current_turn": false, "cards": [], "winning_cards": [ 1, 2, 3 ] } ]

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
26.97 ms | 406 KiB | 5 Q