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) { return count(array_filter( $data, function ($match) use ($value) { return $match['productName'] === $value['productName']; } ) > 1); } ); var_dump($result);
Output for git.master, git.master_jit
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /in/hR8tk:42 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/hR8tk(34): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/hR8tk on line 42
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, true given in /in/hR8tk:42 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/hR8tk(34): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/hR8tk on line 42
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:
46.18 ms | 401 KiB | 8 Q