3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = array('Hugo', 'Manuel'); print_r( array_map( function($name) { return "Olá, " . ucfirst($name) . "!"; }, $names) ); function getGreetingFunction() { $timeOfDay = "morning"; return (function($name) use (&$timeOfDay) { $timeOfDay = ucfirst($timeOfDay); return ("Bom/boa $timeOfDay, $name!"); }); }; $greetingFunction = getGreetingFunction(); echo $greetingFunction("Frederico"); // "Bom dia, Frederico!"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vs4Cn
function name:  (null)
number of ops:  17
compiled vars:  !0 = $names, !1 = $greetingFunction
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'print_r'
    5     2        INIT_FCALL                                               'array_map'
    6     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVs4Cn%3A6%240'
    8     4        SEND_VAL                                                 ~3
    9     5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   21     9        INIT_FCALL                                               'getgreetingfunction'
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !1, $6
   22    12        INIT_DYNAMIC_CALL                                        !1
         13        SEND_VAL_EX                                              'Frederico'
         14        DO_FCALL                                      0  $8      
         15        ECHO                                                     $8
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FVs4Cn%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vs4Cn
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'ucfirst'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        CONCAT                                           ~2      'Ol%C3%A1%2C+', $1
          5        CONCAT                                           ~3      ~2, '%21'
          6      > RETURN                                                   ~3
    8     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVs4Cn%3A6%240

Function getgreetingfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vs4Cn
function name:  getGreetingFunction
number of ops:  5
compiled vars:  !0 = $timeOfDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 'morning'
   15     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVs4Cn%3A15%241'
          2        BIND_LEXICAL                                             ~2, !0
   18     3      > RETURN                                                   ~2
   19     4*     > RETURN                                                   null

End of function getgreetingfunction

Function %00%7Bclosure%7D%2Fin%2FVs4Cn%3A15%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vs4Cn
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $name, !1 = $timeOfDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   16     2        INIT_FCALL                                               'ucfirst'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
   17     6        ROPE_INIT                                     5  ~5      'Bom%2Fboa+'
          7        ROPE_ADD                                      1  ~5      ~5, !1
          8        ROPE_ADD                                      2  ~5      ~5, '%2C+'
          9        ROPE_ADD                                      3  ~5      ~5, !0
         10        ROPE_END                                      4  ~4      ~5, '%21'
         11      > RETURN                                                   ~4
   18    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVs4Cn%3A15%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.48 ms | 1402 KiB | 20 Q