3v4l.org

run code in 300+ PHP versions simultaneously
<?php function preg_array_key_exists($pattern, $array) { $keys = array_keys($array); return (int) preg_grep($pattern,$keys); } //Пример: $arr = array( "DirName" => "Ivan Ivanovich", "DirPhone" => '(843) 123-45-67', "ContactName" => 'Dmitriy Nikolaevich'); $pattern = '/^Dir/'; var_dump(preg_array_key_exists($pattern, $arr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Juli
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, '%2F%5EDir%2F'
   17     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'preg_array_key_exists'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function preg_array_key_exists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Juli
function name:  preg_array_key_exists
number of ops:  13
compiled vars:  !0 = $pattern, !1 = $array, !2 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_keys'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    5     6        INIT_FCALL                                               'preg_grep'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $5      
         10        CAST                                          4  ~6      $5
         11      > RETURN                                                   ~6
    6    12*     > RETURN                                                   null

End of function preg_array_key_exists

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.54 ms | 1398 KiB | 20 Q