3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Original snippet // https://www.strangebuzz.com/en/snippets/modifying-array-values-with-array-map-and-an-anonymous-function $array = [ 'kikoo' => 'cat', 'foo' => 'bar', ]; $array1 = array_map(function ($value) { return $value.$value; }, $array); // for simple cases, pass the PHP function name directly $array2 = array_map('strtoupper', $array); print_r($array1); print_r($array2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VVk2S
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $array1, !2 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   14     3        SEND_VAL                                                 ~4
          4        SEND_VAR                                                 !0
   12     5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
   17     7        INIT_FCALL                                               'array_map'
          8        SEND_VAL                                                 'strtoupper'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
   19    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   20    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VVk2S
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        CONCAT                                           ~1      !0, !0
          2      > RETURN                                                   ~1
   14     3*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.09 ms | 1460 KiB | 15 Q