3v4l.org

run code in 500+ 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:  33
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        FRAMELESS_ICALL_2                strpos              ~9      !0, '%2F'
          3        ASSIGN                                                       !2, ~9
    7     4        INIT_FCALL                                                   'strrpos'
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     '+'
          7        MUL                                                  ~11     !2, -1
          8        SEND_VAL                                                     ~11
          9        DO_ICALL                                             $12     
         10        ASSIGN                                                       !3, $12
    9    11        ADD                                                  ~14     !3, 1
         12        FRAMELESS_ICALL_3                substr              ~15     !0, 0
         13        OP_DATA                                                      ~14
         14        ASSIGN                                                       !4, ~15
   10    15        STRLEN                                               ~17     !0
         16        SUB                                                  ~18     ~17, !2
         17        SUB                                                  ~19     ~18, 1
         18        MUL                                                  ~20     ~19, -1
         19        FRAMELESS_ICALL_2                substr              ~21     !0, ~20
         20        ASSIGN                                                       !5, ~21
   12    21        CONCAT                                               ~23     !4, !5
         22        ASSIGN                                                       !6, ~23
   14    23        INIT_FCALL                                                   'var_dump'
         24        ASSERT_CHECK                                         $26     
         25        INIT_FCALL                                                   'assert'
         26        IS_IDENTICAL                                         ~25     !1, !6
         27        SEND_VAL                                                     ~25
         28        SEND_VAL                                                     'assert%28%24expected+%3D%3D%3D+%24result%29'
         29        DO_ICALL                                             $26     
         30        SEND_VAR                                                     $26
         31        DO_ICALL                                                     
         32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.19 ms | 1988 KiB | 16 Q