3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fullName = 'Karl-Theodor Maria Nikolaus Johann Jacob Philipp Franz Joseph Sylvester Buhl-Freiherr von und zu Guttenberg'; //fullName = 'Philipp Christian Clown'; $nameParts = explode(' ', $fullName); if (count($nameParts) === 1) { return $fullName; } $firstName = $nameParts[0]; $lastInitial = mb_substr($nameParts[1], 0, 1); echo "$firstName $lastInitial.";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KXohr
function name:  (null)
number of ops:  25
compiled vars:  !0 = $fullName, !1 = $nameParts, !2 = $firstName, !3 = $lastInitial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Karl-Theodor+Maria+Nikolaus+Johann+Jacob+Philipp+Franz+Joseph+Sylvester+Buhl-Freiherr+von+und+zu+Guttenberg'
    6     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    8     6        COUNT                                            ~7      !1
          7        IS_IDENTICAL                                             ~7, 1
          8      > JMPZ                                                     ~8, ->10
    9     9    > > RETURN                                                   !0
   12    10    >   FETCH_DIM_R                                      ~9      !1, 0
         11        ASSIGN                                                   !2, ~9
   13    12        INIT_FCALL                                               'mb_substr'
         13        FETCH_DIM_R                                      ~11     !1, 1
         14        SEND_VAL                                                 ~11
         15        SEND_VAL                                                 0
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !3, $12
   15    19        ROPE_INIT                                     4  ~15     !2
         20        ROPE_ADD                                      1  ~15     ~15, '+'
         21        ROPE_ADD                                      2  ~15     ~15, !3
         22        ROPE_END                                      3  ~14     ~15, '.'
         23        ECHO                                                     ~14
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.07 ms | 1003 KiB | 15 Q