3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result=<<<TXT 1 5 7 2 6 9 a c z TXT; $stat=array("odd"=>0,"even"=>0,"invalid"=>array()); foreach(explode("\n",$result) as $r) { $r=trim($r);// in case input is separated by \r\n if(!is_numeric($r)) { $stat["invalid"][]=$r; } elseif($r%2==0) { $stat["even"]+=intval($r); } else { $stat["odd"]+=intval($r); } } echo "Odd: ".$stat["odd"]."\n"; echo "Even: ".$stat["even"]."\n"; echo "Invalid: ".implode(" ",$stat["invalid"]);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 32
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 32
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/io1ur
function name:  (null)
number of ops:  49
compiled vars:  !0 = $result, !1 = $stat, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1%0A5%0A7%0A2%0A6%0A9%0Aa%0Ac%0Az'
   13     1        ASSIGN                                                   !1, <array>
   14     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6      > FE_RESET_R                                       $6      $5, ->32
          7    > > FE_FETCH_R                                               $6, !2, ->32
   16     8    >   INIT_FCALL                                               'trim'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
   17    12        INIT_FCALL                                               'is_numeric'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $9      
         15        BOOL_NOT                                         ~10     $9
         16      > JMPZ                                                     ~10, ->21
   19    17    >   FETCH_DIM_W                                      $11     !1, 'invalid'
         18        ASSIGN_DIM                                               $11
         19        OP_DATA                                                  !2
         20      > JMP                                                      ->31
   21    21    >   MOD                                              ~13     !2, 2
         22        IS_EQUAL                                                 ~13, 0
         23      > JMPZ                                                     ~14, ->28
   23    24    >   CAST                                          4  ~16     !2
         25        ASSIGN_DIM_OP                +=               1          !1, 'even'
         26        OP_DATA                                                  ~16
         27      > JMP                                                      ->31
   27    28    >   CAST                                          4  ~18     !2
         29        ASSIGN_DIM_OP                +=               1          !1, 'odd'
         30        OP_DATA                                                  ~18
   14    31    > > JMP                                                      ->7
         32    >   FE_FREE                                                  $6
   30    33        FETCH_DIM_R                                      ~19     !1, 'odd'
         34        CONCAT                                           ~20     'Odd%3A+', ~19
         35        CONCAT                                           ~21     ~20, '%0A'
         36        ECHO                                                     ~21
   31    37        FETCH_DIM_R                                      ~22     !1, 'even'
         38        CONCAT                                           ~23     'Even%3A+', ~22
         39        CONCAT                                           ~24     ~23, '%0A'
         40        ECHO                                                     ~24
   32    41        INIT_FCALL                                               'implode'
         42        SEND_VAL                                                 '+'
         43        FETCH_DIM_R                                      ~25     !1, 'invalid'
         44        SEND_VAL                                                 ~25
         45        DO_ICALL                                         $26     
         46        CONCAT                                           ~27     'Invalid%3A+', $26
         47        ECHO                                                     ~27
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.99 ms | 1405 KiB | 21 Q