3v4l.org

run code in 300+ PHP versions simultaneously
<?php function odd($var) { // retourne lorsque l'entrée est impaire return($var & 1); } function even($var) { // retourne lorsque l'entrée est paire return(!($var & 1)); } $array1 = array( 0 => 'a', 1 => 2, 2 => 4, 3 => 'd'); echo "Impair :\n"; print_r(array_filter($array1, "odd")); //echo "Pair :\n"; //print_r(array_filter($array2, "even"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bb2fK
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   20     1        ECHO                                                     'Impair+%3A%0A'
   21     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'odd'
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   23     9      > RETURN                                                   1

Function odd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bb2fK
function name:  odd
number of ops:  4
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        BW_AND                                           ~1      !0, 1
          2      > RETURN                                                   ~1
    7     3*     > RETURN                                                   null

End of function odd

Function even:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bb2fK
function name:  even
number of ops:  5
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   12     1        BW_AND                                           ~1      !0, 1
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   13     4*     > RETURN                                                   null

End of function even

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.13 ms | 1395 KiB | 17 Q