3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dataArray = [ [1, 1, 0], [1, 0, 1], [1, 1, 0], [1, 0, 0], [1, 0, 0] ]; $onePositions = array_map(function($row) { return array_map(function($position) { return $position + 1; }, array_keys($row, 1)); }, $dataArray); var_dump($onePositions);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X7lNS
function name:  (null)
number of ops:  11
compiled vars:  !0 = $dataArray, !1 = $onePositions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX7lNS%3A10%240'
   12     3        SEND_VAL                                                 ~3
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
   10     6        ASSIGN                                                   !1, $4
   14     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FX7lNS%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X7lNS
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX7lNS%3A11%241'
          3        SEND_VAL                                                 ~1
          4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10      > RETURN                                                   $3
   12    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX7lNS%3A10%240

Function %00%7Bclosure%7D%2Fin%2FX7lNS%3A11%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X7lNS
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $position
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX7lNS%3A11%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.41 ms | 1401 KiB | 19 Q