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); } $str = "1-a,2-b,3-c"; $temp = preg_split( "/(-|,)/", $str); $result =array_combine(array_filter($temp, "even", ARRAY_FILTER_USE_KEY),array_filter($temp, "odd",ARRAY_FILTER_USE_KEY)); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gp8pr
function name:  (null)
number of ops:  25
compiled vars:  !0 = $str, !1 = $temp, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, '1-a%2C2-b%2C3-c'
   15     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%28-%7C%2C%29%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   17     6        INIT_FCALL                                               'array_combine'
          7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 'even'
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        INIT_FCALL                                               'array_filter'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 'odd'
         16        SEND_VAL                                                 2
         17        DO_ICALL                                         $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                         $8      
         20        ASSIGN                                                   !2, $8
   18    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

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

End of function even

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.83 ms | 1002 KiB | 17 Q