3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array(array("Price" => 66), array("Price" => 99)); function extractPrice($priceType) { $modifier = 10; return function($guestPrice) use($priceType, $modifier) { return $guestPrice[$priceType]*$modifier; }; } var_dump(array_map($extractPrice('Price'), $data));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T5O8a
function name:  (null)
number of ops:  12
compiled vars:  !0 = $data, !1 = $extractPrice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_map'
          3        INIT_DYNAMIC_CALL                                        !1
          4        SEND_VAL_EX                                              'Price'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function extractprice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T5O8a
function name:  extractPrice
number of ops:  7
compiled vars:  !0 = $priceType, !1 = $modifier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 10
    7     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FT5O8a%3A7%240'
          3        BIND_LEXICAL                                             ~3, !0
          4        BIND_LEXICAL                                             ~3, !1
    9     5      > RETURN                                                   ~3
   10     6*     > RETURN                                                   null

End of function extractprice

Function %00%7Bclosure%7D%2Fin%2FT5O8a%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T5O8a
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $guestPrice, !1 = $priceType, !2 = $modifier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    8     3        FETCH_DIM_R                                      ~3      !0, !1
          4        MUL                                              ~4      !2, ~3
          5      > RETURN                                                   ~4
    9     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FT5O8a%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.9 ms | 1396 KiB | 17 Q