3v4l.org

run code in 300+ PHP versions simultaneously
<?php function odd ( $var ) { // returns whether the input integer is odd return( $var & 1 ); } function even ( $var ) { // returns whether the input integer is even return(!( $var & 1 )); } $array1 = array( "a" => 1 , "b" => 2 , "c" => 3 , "d" => 4 , "e" => 5 ); $array2 = array( 6 , 7 , 8 , 9 , 10 , 11 , 12 ); echo "Odd :\n" ; print_r ( array_filter ( $array1 , "odd" )); echo "Even:\n" ; print_r ( array_filter ( $array2 , "even" )); $input = array( "Neo" , "Morpheus" , "Trinity" , "Cypher" , "Tank" ); $rand_keys = array_rand ( $input , 2 ); echo $input [ $rand_keys [ 0 ]] . "\n" ; echo $input [ $rand_keys [ 1 ]] . "\n" ;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h3kJi
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array1, !1 = $array2, !2 = $input, !3 = $rand_keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   18     2        ECHO                                                     'Odd+%3A%0A'
   19     3        INIT_FCALL                                               'print_r'
          4        INIT_FCALL                                               'array_filter'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'odd'
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
   20    10        ECHO                                                     'Even%3A%0A'
   21    11        INIT_FCALL                                               'print_r'
         12        INIT_FCALL                                               'array_filter'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 'even'
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                                 
   24    18        ASSIGN                                                   !2, <array>
   25    19        INIT_FCALL                                               'array_rand'
         20        SEND_VAR                                                 !2
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !3, $11
   26    24        FETCH_DIM_R                                      ~13     !3, 0
         25        FETCH_DIM_R                                      ~14     !2, ~13
         26        CONCAT                                           ~15     ~14, '%0A'
         27        ECHO                                                     ~15
   27    28        FETCH_DIM_R                                      ~16     !3, 1
         29        FETCH_DIM_R                                      ~17     !2, ~16
         30        CONCAT                                           ~18     ~17, '%0A'
         31        ECHO                                                     ~18
         32      > RETURN                                                   1

Function odd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h3kJi
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/h3kJi
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:
149.09 ms | 1400 KiB | 19 Q