3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stock = ["7", "5", "3"]; $request = ["3", "6", "3"]; echo "Are there any items with insufficient stock: "; var_export( array_any( $stock, fn($v, $i) => $v < $request[$i] ) ); echo "\n---\nDo all items have sufficient stock: "; var_export( array_all( $stock, fn($v, $i) => $v >= $request[$i] ) ); echo "\n---\nWhich stock item value is insufficient: "; // more helpful if $v was a row from a 2d array var_export( array_find( $stock, fn($v, $i) => $v < $request[$i] ) ); echo "\n---\nWhich stock indexes have an insufficient amount: "; var_export( array_find_key( $stock, fn($v, $i) => $v < $request[$i] ) );
Output for git.master_jit, git.master
Are there any items with insufficient stock: true --- Do all items have sufficient stock: false --- Which stock item value is insufficient: '5' --- Which stock indexes have an insufficient amount: 1

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:
29.16 ms | 405 KiB | 5 Q