3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = ' - "True Monitoring Range #29 - windows checker units"'; function hasInlineCommentInSequence($line) { if (strpos(ltrim($line), '-') !== 0) { return false; } $trimmed = trim($line); $hashPos = strpos($trimmed, ' #'); if ($hashPos === false) { return false; } $count = substr_count($trimmed, '"', 0, $hashPos); return ($count % 2) === 0; } var_dump(hasInlineCommentInSequence($string));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8WtCs
function name:  (null)
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '++++++++++++++++++-+%22True+Monitoring+Range+%2329+-+windows+checker+units%22'
   21     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'hasinlinecommentinsequence'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function hasinlinecommentinsequence:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8WtCs
function name:  hasInlineCommentInSequence
number of ops:  34
compiled vars:  !0 = $line, !1 = $trimmed, !2 = $hashPos, !3 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'strpos'
          2        INIT_FCALL                                               'ltrim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        SEND_VAR                                                 $4
          6        SEND_VAL                                                 '-'
          7        DO_ICALL                                         $5      
          8        IS_NOT_IDENTICAL                                         $5, 0
          9      > JMPZ                                                     ~6, ->11
    7    10    > > RETURN                                                   <false>
   10    11    >   INIT_FCALL                                               'trim'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        ASSIGN                                                   !1, $7
   11    15        INIT_FCALL                                               'strpos'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 '+%23'
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !2, $9
   13    20        TYPE_CHECK                                    4          !2
         21      > JMPZ                                                     ~11, ->23
   14    22    > > RETURN                                                   <false>
   17    23    >   INIT_FCALL                                               'substr_count'
         24        SEND_VAR                                                 !1
         25        SEND_VAL                                                 '%22'
         26        SEND_VAL                                                 0
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $12     
         29        ASSIGN                                                   !3, $12
   19    30        MOD                                              ~14     !3, 2
         31        IS_IDENTICAL                                     ~15     ~14, 0
         32      > RETURN                                                   ~15
   20    33*     > RETURN                                                   null

End of function hasinlinecommentinsequence

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.79 ms | 1403 KiB | 24 Q