3v4l.org

run code in 300+ PHP versions simultaneously
<?php const CODE_MAP = [ 'Reading Comprehension' => 2, 'Elementary Algebra' => 6, 'College Level Math' => 7, 'Sentence Skills' => 1, 'Arithmetic' => 5, ]; const POST_TEST = 'Post Test'; const BASIC_PREFIX = 'AC'; const POST_PREFIX = 'PA'; $BRANCHING_PROFILE = "09. Reading Comprehension - Post Test"; $code = null; foreach (CODE_MAP as $search => $subCode) { if (stripos($BRANCHING_PROFILE, $search) === false) { continue; } $prefix = stripos($BRANCHING_PROFILE, POST_TEST) === false ? BASIC_PREFIX : POST_PREFIX; $code = $prefix . $subCode; break; } var_dump($code);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 34
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 34
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 34
Branch analysis from position: 34
filename:       /in/oc54l
function name:  (null)
number of ops:  39
compiled vars:  !0 = $BRANCHING_PROFILE, !1 = $code, !2 = $subCode, !3 = $search, !4 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'CODE_MAP', <array>
   11     1        DECLARE_CONST                                            'POST_TEST', 'Post+Test'
   13     2        DECLARE_CONST                                            'BASIC_PREFIX', 'AC'
   14     3        DECLARE_CONST                                            'POST_PREFIX', 'PA'
   16     4        ASSIGN                                                   !0, '09.+Reading+Comprehension+-+Post+Test'
   18     5        ASSIGN                                                   !1, null
   20     6        FETCH_CONSTANT                                   ~7      'CODE_MAP'
          7      > FE_RESET_R                                       $8      ~7, ->34
          8    > > FE_FETCH_R                                       ~9      $8, !2, ->34
          9    >   ASSIGN                                                   !3, ~9
   21    10        INIT_FCALL                                               'stripos'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $11     
         14        TYPE_CHECK                                    4          $11
         15      > JMPZ                                                     ~12, ->17
   22    16    > > JMP                                                      ->8
   25    17    >   INIT_FCALL                                               'stripos'
         18        SEND_VAR                                                 !0
         19        FETCH_CONSTANT                                   ~13     'POST_TEST'
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        TYPE_CHECK                                    4          $14
         23      > JMPZ                                                     ~15, ->27
         24    >   FETCH_CONSTANT                                   ~16     'BASIC_PREFIX'
         25        QM_ASSIGN                                        ~17     ~16
         26      > JMP                                                      ->29
         27    >   FETCH_CONSTANT                                   ~18     'POST_PREFIX'
         28        QM_ASSIGN                                        ~17     ~18
         29    >   ASSIGN                                                   !4, ~17
   26    30        CONCAT                                           ~20     !4, !2
         31        ASSIGN                                                   !1, ~20
   28    32      > JMP                                                      ->34
   20    33*       JMP                                                      ->8
         34    >   FE_FREE                                                  $8
   31    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.17 ms | 1006 KiB | 15 Q