3v4l.org

run code in 300+ PHP versions simultaneously
<?php function v1($first, $last) { $result = trim($first); $lastName = trim($last); if ($lastName) { if (!empty($result)) { $result .= ' '; } $result .= $lastName; } return $result; } function v2($first, $last) { return implode(" ", [trim($first), trim($last)]); } function v($first, $last) { echo v1($first, $last); echo PHP_EOL; echo v2($first, $last); } v();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p1RP2
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'v'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function v1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 16
filename:       /in/p1RP2
function name:  v1
number of ops:  18
compiled vars:  !0 = $first, !1 = $last, !2 = $result, !3 = $lastName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !2, $4
    6     6        INIT_FCALL                                               'trim'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !3, $6
    7    10      > JMPZ                                                     !3, ->16
    8    11    >   ISSET_ISEMPTY_CV                                 ~8      !2
         12        BOOL_NOT                                         ~9      ~8
         13      > JMPZ                                                     ~9, ->15
    9    14    >   ASSIGN_OP                                     8          !2, '+'
   11    15    >   ASSIGN_OP                                     8          !2, !3
   14    16    > > RETURN                                                   !2
   15    17*     > RETURN                                                   null

End of function v1

Function v2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p1RP2
function name:  v2
number of ops:  16
compiled vars:  !0 = $first, !1 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '+'
          4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        INIT_ARRAY                                       ~3      $2
          8        INIT_FCALL                                               'trim'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $4      
         11        ADD_ARRAY_ELEMENT                                ~3      $4
         12        SEND_VAL                                                 ~3
         13        DO_ICALL                                         $5      
         14      > RETURN                                                   $5
   20    15*     > RETURN                                                   null

End of function v2

Function v:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p1RP2
function name:  v
number of ops:  14
compiled vars:  !0 = $first, !1 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        INIT_FCALL                                               'v1'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
   25     7        ECHO                                                     '%0A'
   26     8        INIT_FCALL                                               'v2'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $3      
         12        ECHO                                                     $3
   27    13      > RETURN                                                   null

End of function v

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.99 ms | 1394 KiB | 20 Q