3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Hello, How are you ? this: is testing"; $chars = [",", "|", ":"]; $pos =0; foreach($chars as $char){ if(strrpos($str, $char)>$pos) $pos = strrpos($str, $char); } if($pos == 0) $pos=strlen($str); echo substr($str, 0, $pos);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 17
filename:       /in/XKs2Z
function name:  (null)
number of ops:  29
compiled vars:  !0 = $str, !1 = $chars, !2 = $pos, !3 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Hello%2C+How+are+you+%3F+this%3A+is+testing'
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 0
    6     3      > FE_RESET_R                                       $7      !1, ->17
          4    > > FE_FETCH_R                                               $7, !3, ->17
    7     5    >   INIT_FCALL                                               'strrpos'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $8      
          9        IS_SMALLER                                               !2, $8
         10      > JMPZ                                                     ~9, ->16
         11    >   INIT_FCALL                                               'strrpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !2, $10
    6    16    > > JMP                                                      ->4
         17    >   FE_FREE                                                  $7
    9    18        IS_EQUAL                                                 !2, 0
         19      > JMPZ                                                     ~12, ->22
         20    >   STRLEN                                           ~13     !0
         21        ASSIGN                                                   !2, ~13
   10    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 0
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $15     
         27        ECHO                                                     $15
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.65 ms | 1000 KiB | 15 Q