3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(1, 2, 3, 4, 4, 1, 2, 5, 5, 11, 11); // build and initialize array to track counts $count = array_flip( array_unique( $arr ) ); foreach( $count as $key => $value ) { $count[$key] = 0; } // counting ... foreach ($arr as $key => $value) { $count[$value] += 1; } // result: foreach ( $count as $item => $num ) { if ( $num == 1 ) { echo "$item appears only once.\n"; } }
Output for git.master, git.master_jit, rfc.property-hooks
3 appears only once.

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