3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_SESSION['diceRoll'] = [ ["save_1" => ["pos1" => 0, "pos2" => 2, "pos3" => 0, "pos4" => 0, "pos5" => 3, "pos6" => 0]], ["save_2" => ["pos1" => 0, "pos2" => 6, "pos3" => 0, "pos4" => 5, "pos5" => 1, "pos6" => 0]], ["save_3" => ["pos1" => 2, "pos2" => 0, "pos3" => 5, "pos4" => 0, "pos5" => 2, "pos6" => 2]], ["save_4" => ["pos1" => 0, "pos2" => 6, "pos3" => 6, "pos4" => 5, "pos5" => 5, "pos6" => 0]], ["save_5" => ["pos1" => 2, "pos2" => 0, "pos3" => 4, "pos4" => 4, "pos5" => 0, "pos6" => 0]], ["save_6" => ["pos1" => 3, "pos2" => 0, "pos3" => 4, "pos4" => 0, "pos5" => 5, "pos6" => 5]] ]; function updateMissingDiceRolls(&$array) { array_walk_recursive($array, fn(&$v) => $v = $v ?: mt_rand(1, 6)); } updateMissingDiceRolls($_SESSION['diceRoll']); var_export($_SESSION['diceRoll']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T16dl
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_W                      global              $0      '_SESSION'
          1        ASSIGN_DIM                                               $0, 'diceRoll'
    4     2        OP_DATA                                                  <array>
   15     3        INIT_FCALL                                               'updatemissingdicerolls'
          4        FETCH_W                      global              $2      '_SESSION'
          5        FETCH_DIM_W                                      $3      $2, 'diceRoll'
          6        SEND_REF                                                 $3
          7        DO_FCALL                                      0          
   16     8        INIT_FCALL                                               'var_export'
          9        FETCH_R                      global              ~5      '_SESSION'
         10        FETCH_DIM_R                                      ~6      ~5, 'diceRoll'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function updatemissingdicerolls:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T16dl
function name:  updateMissingDiceRolls
number of ops:  7
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'array_walk_recursive'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~1      [0]
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
   14     6      > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T16dl
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        JMP_SET                                          ~1      !0, ->7
          2        INIT_FCALL                                               'mt_rand'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 6
          5        DO_ICALL                                         $2      
          6        QM_ASSIGN                                        ~1      $2
          7        ASSIGN                                           ~3      !0, ~1
          8      > RETURN                                                   ~3
          9*     > RETURN                                                   null

End of Dynamic Function 0

End of function updatemissingdicerolls

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.5 ms | 1010 KiB | 17 Q