3v4l.org

run code in 500+ PHP versions simultaneously
<?php $strings = ["White", "White Tank", "White Tank Top"]; foreach ($strings as $string) { echo "\n{$string}:"; echo "\n-\t" , substr($string, 1 + (strpos($string, ' ') ?: -1)); $explodeOnce = explode(' ', $string, 2); echo "\n-\t" , end($explodeOnce); echo "\n-\t" , substr(strstr($string, " "), 1); echo "\n-\t" , ltrim(strstr($string, " ")); echo "\n-\t" , preg_replace('~^\S+\s~', '', $string); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 40
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 40
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/b46CI
function name:  (null)
number of ops:  42
compiled vars:  !0 = $strings, !1 = $string, !2 = $explodeOnce
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1      > FE_RESET_R                                           $4      !0, ->40
          2    > > FE_FETCH_R                                                   $4, !1, ->40
    5     3    >   ROPE_INIT                                         3  ~6      '%0A'
          4        ROPE_ADD                                          1  ~6      ~6, !1
          5        ROPE_END                                          2  ~5      ~6, '%3A'
          6        ECHO                                                         ~5
    6     7        ECHO                                                         '%0A-%09'
          8        FRAMELESS_ICALL_2                strpos              ~8      !1, '+'
          9        JMP_SET                                              ~9      ~8, ->11
         10        QM_ASSIGN                                            ~9      -1
         11        ADD                                                  ~10     1, ~9
         12        FRAMELESS_ICALL_2                substr              ~11     !1, ~10
         13        ECHO                                                         ~11
    8    14        INIT_FCALL                                                   'explode'
         15        SEND_VAL                                                     '+'
         16        SEND_VAR                                                     !1
         17        SEND_VAL                                                     2
         18        DO_ICALL                                             $12     
         19        ASSIGN                                                       !2, $12
    9    20        ECHO                                                         '%0A-%09'
         21        INIT_FCALL                                                   'end'
         22        SEND_REF                                                     !2
         23        DO_ICALL                                             $14     
         24        ECHO                                                         $14
   11    25        ECHO                                                         '%0A-%09'
         26        FRAMELESS_ICALL_2                strstr              ~15     !1, '+'
         27        FRAMELESS_ICALL_2                substr              ~16     ~15, 1
         28        ECHO                                                         ~16
   13    29        ECHO                                                         '%0A-%09'
         30        INIT_FCALL                                                   'ltrim'
         31        FRAMELESS_ICALL_2                strstr              ~17     !1, '+'
         32        SEND_VAL                                                     ~17
         33        DO_ICALL                                             $18     
         34        ECHO                                                         $18
   15    35        ECHO                                                         '%0A-%09'
         36        FRAMELESS_ICALL_3                preg_replace        ~19     '%7E%5E%5CS%2B%5Cs%7E', ''
         37        OP_DATA                                                      !1
         38        ECHO                                                         ~19
    4    39      > JMP                                                          ->2
         40    >   FE_FREE                                                      $4
   17    41      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
219.67 ms | 2162 KiB | 16 Q