3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_delete($array, $element) { return array_diff($array, [$element]); } $profiles = array('1', '2', 'patient'); if (in_array('patient', $profiles) ){ echo 'yesy'; array_delete($profiles, 'patient'); } var_dump($profiles);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/gl8c7
function name:  (null)
number of ops:  15
compiled vars:  !0 = $profiles
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
    7     1        INIT_FCALL                                               'in_array'
          2        SEND_VAL                                                 'patient'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5      > JMPZ                                                     $2, ->11
    8     6    >   ECHO                                                     'yesy'
    9     7        INIT_FCALL                                               'array_delete'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'patient'
         10        DO_FCALL                                      0          
   12    11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function array_delete:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gl8c7
function name:  array_delete
number of ops:  9
compiled vars:  !0 = $array, !1 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'array_diff'
          3        SEND_VAR                                                 !0
          4        INIT_ARRAY                                       ~2      !1
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
    4     8*     > RETURN                                                   null

End of function array_delete

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.49 ms | 1402 KiB | 20 Q