3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myWondersArray = array ( 0 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 1/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_1/', ), 1 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 2/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_2/', ), 2 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 3/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_3/', ), 3 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 1/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_1/', ), 4 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 2/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_2/', ), 5 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 3/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_3/', ), 6 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 1/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_1/', ), 7 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 2/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_2/', ), 8 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 3/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_3/', ), ); $buckets = array_fill_keys(['previous', 'current', 'next'], []); foreach ($myWondersArray as $obj) { $buckets[substr(key((array) $obj), 0, -11)][] = $obj; } var_export(array_merge(...array_values($buckets)));
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
array ( 0 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 1/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_1/', ), 1 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 2/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_2/', ), 2 => (object) array( 'previousUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 2 - Sid\'s New Neighbors (Part 3/3)', 'previousUnitPart' => 'wonderskills/starter_book_2/unit_2_sids_new_neighbors/part_3/', ), 3 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 1/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_1/', ), 4 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 2/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_2/', ), 5 => (object) array( 'currentUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 3 - Helping Mom (Part 3/3)', 'currentUnitPart' => 'wonderskills/starter_book_2/unit_3_helping_mom/part_3/', ), 6 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 1/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_1/', ), 7 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 2/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_2/', ), 8 => (object) array( 'nextUnitDisplay' => 'WonderSkills: Starter Book 2, Unit 4 - Food from the Garden (Part 3/3)', 'nextUnitPart' => 'wonderskills/starter_book_2/unit_4_food_from_the_garden/part_3/', ), )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
93.54 ms | 409 KiB | 5 Q