3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = array( array('mopo_1' => 'honta', 'hinta' => 200, 'mopo_2' => 'jamaha', 'hinta' => 320), array('mopo_1' => 'tunturi', 'hinta' => 180, 'mopo_3' => 'susuki', 'hinta' => 310), array('mopo_1' => 'manki', 'hinta' => 240, 'mopo_2' => 'peevee', 'hinta' => 1209) ); 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 ( ) Array ( )

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.44 ms | 401 KiB | 8 Q