3v4l.org

run code in 300+ 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 = 58
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 58
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/b46CI
function name:  (null)
number of ops:  60
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, ->58
          2    > > FE_FETCH_R                                               $4, !1, ->58
    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        INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !1
         10        INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 '+'
         13        DO_ICALL                                         $8      
         14        JMP_SET                                          ~9      $8, ->16
         15        QM_ASSIGN                                        ~9      -1
         16        ADD                                              ~10     1, ~9
         17        SEND_VAL                                                 ~10
         18        DO_ICALL                                         $11     
         19        ECHO                                                     $11
    8    20        INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '+'
         22        SEND_VAR                                                 !1
         23        SEND_VAL                                                 2
         24        DO_ICALL                                         $12     
         25        ASSIGN                                                   !2, $12
    9    26        ECHO                                                     '%0A-%09'
         27        INIT_FCALL                                               'end'
         28        SEND_REF                                                 !2
         29        DO_ICALL                                         $14     
         30        ECHO                                                     $14
   11    31        ECHO                                                     '%0A-%09'
         32        INIT_FCALL                                               'substr'
         33        INIT_FCALL                                               'strstr'
         34        SEND_VAR                                                 !1
         35        SEND_VAL                                                 '+'
         36        DO_ICALL                                         $15     
         37        SEND_VAR                                                 $15
         38        SEND_VAL                                                 1
         39        DO_ICALL                                         $16     
         40        ECHO                                                     $16
   13    41        ECHO                                                     '%0A-%09'
         42        INIT_FCALL                                               'ltrim'
         43        INIT_FCALL                                               'strstr'
         44        SEND_VAR                                                 !1
         45        SEND_VAL                                                 '+'
         46        DO_ICALL                                         $17     
         47        SEND_VAR                                                 $17
         48        DO_ICALL                                         $18     
         49        ECHO                                                     $18
   15    50        ECHO                                                     '%0A-%09'
         51        INIT_FCALL                                               'preg_replace'
         52        SEND_VAL                                                 '%7E%5E%5CS%2B%5Cs%7E'
         53        SEND_VAL                                                 ''
         54        SEND_VAR                                                 !1
         55        DO_ICALL                                         $19     
         56        ECHO                                                     $19
    4    57      > JMP                                                      ->2
         58    >   FE_FREE                                                  $4
   17    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.73 ms | 1013 KiB | 20 Q