3v4l.org

run code in 300+ PHP versions simultaneously
<?php generate(80,10); function generate($start, $level){ $i=1; // Just a var $array = array_fill(0, $level, $start); // create an array with $level elements, with value $start array_map(function($v)use(&$i){ // Loop through the array and use $i echo "Level $i: ".(array_product(array($v, pow(1.5, $i++))))."<br>"; // Some basic math and output }, $array); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A612O
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'generate'
          1        SEND_VAL_EX                                              80
          2        SEND_VAL_EX                                              10
          3        DO_FCALL                                      0          
   12     4      > RETURN                                                   1

Function generate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A612O
function name:  generate
number of ops:  16
compiled vars:  !0 = $start, !1 = $level, !2 = $i, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, 1
    6     3        INIT_FCALL                                               'array_fill'
          4        SEND_VAL                                                 0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !3, $5
    7     9        INIT_FCALL                                               'array_map'
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FA612O%3A7%240'
         11        BIND_LEXICAL                                             ~7, !2
    9    12        SEND_VAL                                                 ~7
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
   10    15      > RETURN                                                   null

End of function generate

Function %00%7Bclosure%7D%2Fin%2FA612O%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A612O
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $v, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    8     2        ROPE_INIT                                     3  ~3      'Level+'
          3        ROPE_ADD                                      1  ~3      ~3, !1
          4        ROPE_END                                      2  ~2      ~3, '%3A+'
          5        INIT_FCALL                                               'array_product'
          6        INIT_ARRAY                                       ~5      !0
          7        INIT_FCALL                                               'pow'
          8        SEND_VAL                                                 1.5
          9        POST_INC                                         ~6      !1
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        ADD_ARRAY_ELEMENT                                ~5      $7
         13        SEND_VAL                                                 ~5
         14        DO_ICALL                                         $8      
         15        CONCAT                                           ~9      ~2, $8
         16        CONCAT                                           ~10     ~9, '%3Cbr%3E'
         17        ECHO                                                     ~10
    9    18      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.74 ms | 1400 KiB | 21 Q