3v4l.org

run code in 300+ PHP versions simultaneously
<?php $example = 'your string here, please/do it by yourself.'; $expected = 'your string here, do it by yourself.'; $slashPos = strpos($example, '/'); $spacePos = strrpos($example, ' ', -1 * $slashPos); $string1 = substr($example, 0, $spacePos + 1); $string2 = substr($example, (strlen($example) - $slashPos - 1) * -1); $result = $string1 . $string2; var_dump(assert($expected === $result));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XVruS
function name:  (null)
number of ops:  42
compiled vars:  !0 = $example, !1 = $expected, !2 = $slashPos, !3 = $spacePos, !4 = $string1, !5 = $string2, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'your+string+here%2C+please%2Fdo+it+by+yourself.'
    4     1        ASSIGN                                                   !1, 'your+string+here%2C+do+it+by+yourself.'
    6     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 '%2F'
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
    7     7        INIT_FCALL                                               'strrpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '+'
         10        MUL                                              ~11     !2, -1
         11        SEND_VAL                                                 ~11
         12        DO_ICALL                                         $12     
         13        ASSIGN                                                   !3, $12
    9    14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 0
         17        ADD                                              ~14     !3, 1
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !4, $15
   10    21        INIT_FCALL                                               'substr'
         22        SEND_VAR                                                 !0
         23        STRLEN                                           ~17     !0
         24        SUB                                              ~18     ~17, !2
         25        SUB                                              ~19     ~18, 1
         26        MUL                                              ~20     ~19, -1
         27        SEND_VAL                                                 ~20
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !5, $21
   12    30        CONCAT                                           ~23     !4, !5
         31        ASSIGN                                                   !6, ~23
   14    32        INIT_FCALL                                               'var_dump'
         33        ASSERT_CHECK                                     $26     
         34        INIT_FCALL                                               'assert'
         35        IS_IDENTICAL                                     ~25     !1, !6
         36        SEND_VAL                                                 ~25
         37        SEND_VAL                                                 'assert%28%24expected+%3D%3D%3D+%24result%29'
         38        DO_ICALL                                         $26     
         39        SEND_VAR                                                 $26
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.11 ms | 1010 KiB | 18 Q