3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 'aaa'; $b = 'ahoj aaa'; echo substr($b, 0, -strlen($a - 1)); echo "\n"; echo substr($b, 0, -strlen($a) - 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v4p3t
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aaa'
    4     1        ASSIGN                                                   !1, 'ahoj+aaa'
    5     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 0
          5        SUB                                              ~4      !0, 1
          6        STRLEN                                           ~5      ~4
          7        MUL                                              ~6      ~5, -1
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        ECHO                                                     $7
    6    11        ECHO                                                     '%0A'
    7    12        INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 0
         15        STRLEN                                           ~8      !0
         16        MUL                                              ~9      ~8, -1
         17        SUB                                              ~10     ~9, 1
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                         $11     
         20        ECHO                                                     $11
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.57 ms | 1399 KiB | 15 Q