3v4l.org

run code in 500+ PHP versions simultaneously
<?php var_dump(remove_last('bla test bla test bla test bla test bla', 'test', ' ')); function remove_last(string $text, string $subject, string $separator): string { if (($offset = strrpos($text, "$separator$subject")) === false) { $offset = strrpos($text, "$subject$separate"); } if ($offset !== false) { return substr_replace($text, '', $offset, strlen("$separator$subject")); } return $text; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZUULc
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL_BY_NAME                                           'remove_last'
          2        SEND_VAL_EX                                                  'bla+test+bla+test+bla+test+bla+test+bla'
          3        SEND_VAL_EX                                                  'test'
          4        SEND_VAL_EX                                                  '+'
          5        DO_FCALL                                          0  $0      
          6        SEND_VAR                                                     $0
          7        DO_ICALL                                                     
   15     8      > RETURN                                                       1

Function remove_last:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 32
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/ZUULc
function name:  remove_last
number of ops:  36
compiled vars:  !0 = $text, !1 = $subject, !2 = $separator, !3 = $offset, !4 = $separate
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
    6     3        INIT_FCALL                                                   'strrpos'
          4        SEND_VAR                                                     !0
          5        NOP                                                          
          6        FAST_CONCAT                                          ~5      !2, !1
          7        SEND_VAL                                                     ~5
          8        DO_ICALL                                             $6      
          9        ASSIGN                                               ~7      !3, $6
         10        TYPE_CHECK                                        4          ~7
         11      > JMPZ                                                         ~8, ->19
    7    12    >   INIT_FCALL                                                   'strrpos'
         13        SEND_VAR                                                     !0
         14        NOP                                                          
         15        FAST_CONCAT                                          ~9      !1, !4
         16        SEND_VAL                                                     ~9
         17        DO_ICALL                                             $10     
         18        ASSIGN                                                       !3, $10
   10    19    >   TYPE_CHECK                                      1018          !3
         20      > JMPZ                                                         ~12, ->32
   11    21    >   INIT_FCALL                                                   'substr_replace'
         22        SEND_VAR                                                     !0
         23        SEND_VAL                                                     ''
         24        SEND_VAR                                                     !3
         25        NOP                                                          
         26        FAST_CONCAT                                          ~13     !2, !1
         27        STRLEN                                               ~14     ~13
         28        SEND_VAL                                                     ~14
         29        DO_ICALL                                             $15     
         30        VERIFY_RETURN_TYPE                                           $15
         31      > RETURN                                                       $15
   14    32    >   VERIFY_RETURN_TYPE                                           !0
         33      > RETURN                                                       !0
   15    34*       VERIFY_RETURN_TYPE                                           
         35*     > RETURN                                                       null

End of function remove_last

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
143.41 ms | 2034 KiB | 16 Q