3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array( 'name' => 'Supplier A', 'productName' => 'ABC', ), array( 'name' => 'Supplier B', 'productName' => 'ABC', ), array( 'name' => 'Supplier B', 'productName' => 'DEF', ), array( 'name' => 'Supplier C', 'productName' => 'XYZ', ), array( 'name' => 'Supplier D', 'productName' => 'BBB', ), array( 'name' => 'Supplier E', 'productName' => 'ABCDEF', ), array( 'name' => 'Supplier F', 'productName' => 'ABCDEF', ), ); $result = array_filter( $data, function($value) use ($data) { echo 'TEST', PHP_EOL; return count(array_filter( $data, function ($match) use ($value) { echo $match['productName'], ' => ', $value['productName'], PHP_EOL; return $match['productName'] === $value['productName']; } ) > 1); } ); var_dump($result);
Output for git.master, git.master_jit
TEST ABC => ABC ABC => ABC DEF => ABC XYZ => ABC BBB => ABC ABCDEF => ABC ABCDEF => ABC Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /in/7O30Y:44 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/7O30Y(34): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/7O30Y on line 44
Process exited with code 255.
Output for rfc.property-hooks
TEST ABC => ABC ABC => ABC DEF => ABC XYZ => ABC BBB => ABC ABCDEF => ABC ABCDEF => ABC Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, true given in /in/7O30Y:44 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/7O30Y(34): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/7O30Y on line 44
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:
53.75 ms | 401 KiB | 8 Q