3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ // ['order' => null, 'seriesId' => 2], // ['order' => 0, 'seriesId' => 1], ]; function validateOrderUniqueness(array $data) { $orders = array_filter(array_column($data, 'order')); $uniqueOrders = array_unique($orders); if ($orders !== $uniqueOrders) { throw new \Exception('validateOrderUniqueness fail'); } } function validateSeriesUniqueness(array $data) { $seriesIds = array_column($data, 'seriesId'); $uniqueSeriesIds = array_unique($seriesIds); if ($seriesIds !== $uniqueSeriesIds) { throw new \Exception('validateSeriesUniqueness fail'); } } $existing = [1, 2, 3]; validateOrderUniqueness($data); validateSeriesUniqueness($data); $seriesIds = array_column($data, 'seriesId'); if (count(array_diff($existing, $seriesIds)) > 0) { throw new \Exception('MISSING_ORDER_OF_SERIES fail'); } if (count(array_diff($seriesIds, $existing)) > 0) { throw new \Exception('NON_EXISTING_SERIES fail'); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception: MISSING_ORDER_OF_SERIES fail in /in/gACFB:36 Stack trace: #0 {main} thrown in /in/gACFB on line 36
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:
58.53 ms | 401 KiB | 8 Q