3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = array('mopo_1' => 'honta', 'hinta' => 200, 'mopo_2' => 'jamaha', 'hinta' => 320, 'mopo_3' => 'susuki', 'hinta' => 310); function array_key_exists_wildcard ( $array, $search, $return = '' ) { $search = str_replace( '\*', '.*?', preg_quote( $search, '/' ) ); $result = preg_grep( '/^' . $search . '$/i', array_keys( $array ) ); if ( $return == 'key-value' ) return array_intersect_key( $array, array_flip( $result ) ); return $result; } $search = 'mopo*'; print_r( array_key_exists_wildcard( $ar, $search ) ); print_r( array_key_exists_wildcard( $ar, $search, 'key-value' ) );
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => mopo_1 [2] => mopo_2 [3] => mopo_3 ) Array ( [mopo_1] => honta [mopo_2] => jamaha [mopo_3] => susuki )

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:
60.74 ms | 401 KiB | 8 Q