3v4l.org

run code in 300+ PHP versions simultaneously
<?php $response2_decoded = json_decode($response2, true); echo "<pre>"; // drill your way down and see what keys are available var_export(array_keys($response2_decoded)); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0])); // <-- needed this one echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile'])); // <-- needed this one echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats']['attributes'])); echo "<br>"; var_export(array_keys($response2_decoded['profileChanges'][0]['profile']['stats']['attributes']['past_seasons'])); // found it, use it! echo "<br>"; // vvvvvvvv-- be careful of typos here foreach ($response2_decoded['profileChanges'][0]['profile']['stats']['attributes']['past_seasons'] as $set) { $array_seasons[] = ["season" => $set['seasonNumber'], "battle_pass" => $set['purchasedVIP']]; } echo json_encode(["seasons" => $array_seasons]);
Output for rfc.property-hooks, git.master, git.master_jit
Warning: Undefined variable $response2 in /in/p4cMO on line 2 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/p4cMO on line 2 <pre> Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /in/p4cMO:4 Stack trace: #0 /in/p4cMO(4): array_keys(NULL) #1 {main} thrown in /in/p4cMO on line 4
Process exited with code 255.

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:
50.07 ms | 3051 KiB | 4 Q