3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array('name' => 'User 1', 'email' => 'user.1@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 2', 'email' => 'user.2@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 3', 'email' => 'user.3@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 4', 'email' => 'user.4@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 5', 'email' => 'user.5@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 6', 'email' => 'user.6@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 7', 'email' => 'user.7@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 8', 'email' => 'user.8@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 9', 'email' => 'user.9@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 10', 'email' => 'user.10@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), array('name' => 'User 11', 'email' => 'user.11@example.com', 'sex' => 1, 'active' => 1, 'banned' => 0, ), ); $start_time1 = microtime(TRUE); $outputData = array(); foreach($data as $id => $user){ $outputData[] = array( 'name' => $user['name'], 'email' => $user['email'], 'banned' => $user['banned'], ); } //var_dump($outputData); $end_time1 = microtime(TRUE); echo 'Foreach: '.($end_time1 - $start_time1) ."\n\n"; $start_time2 = microtime(TRUE); $outputData = array_map(function($user){ return array( 'name' => $user['name'], 'email' => $user['email'], 'banned' => $user['banned'], ); }, $data); //var_dump($outputData); $end_time2 = microtime(TRUE); echo 'Array_map: '.($end_time2 - $start_time2) ."\n\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/2nFlT
function name:  (null)
number of ops:  46
compiled vars:  !0 = $data, !1 = $start_time1, !2 = $outputData, !3 = $user, !4 = $id, !5 = $end_time1, !6 = $start_time2, !7 = $end_time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $9      
          4        ASSIGN                                                   !1, $9
   20     5        ASSIGN                                                   !2, <array>
   21     6      > FE_RESET_R                                       $12     !0, ->18
          7    > > FE_FETCH_R                                       ~13     $12, !3, ->18
          8    >   ASSIGN                                                   !4, ~13
   24     9        FETCH_DIM_R                                      ~16     !3, 'name'
         10        INIT_ARRAY                                       ~17     ~16, 'name'
   25    11        FETCH_DIM_R                                      ~18     !3, 'email'
         12        ADD_ARRAY_ELEMENT                                ~17     ~18, 'email'
   26    13        FETCH_DIM_R                                      ~19     !3, 'banned'
         14        ADD_ARRAY_ELEMENT                                ~17     ~19, 'banned'
   23    15        ASSIGN_DIM                                               !2
   26    16        OP_DATA                                                  ~17
   21    17      > JMP                                                      ->7
         18    >   FE_FREE                                                  $12
   30    19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $20     
         22        ASSIGN                                                   !5, $20
   32    23        SUB                                              ~22     !5, !1
         24        CONCAT                                           ~23     'Foreach%3A+', ~22
         25        CONCAT                                           ~24     ~23, '%0A%0A'
         26        ECHO                                                     ~24
   35    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $25     
         30        ASSIGN                                                   !6, $25
   37    31        INIT_FCALL                                               'array_map'
         32        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2nFlT%3A37%240'
   43    33        SEND_VAL                                                 ~27
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $28     
   37    36        ASSIGN                                                   !2, $28
   45    37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $30     
         40        ASSIGN                                                   !7, $30
   47    41        SUB                                              ~32     !7, !6
         42        CONCAT                                           ~33     'Array_map%3A+', ~32
         43        CONCAT                                           ~34     ~33, '%0A%0A'
         44        ECHO                                                     ~34
         45      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F2nFlT%3A37%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2nFlT
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   39     1        FETCH_DIM_R                                      ~1      !0, 'name'
          2        INIT_ARRAY                                       ~2      ~1, 'name'
   40     3        FETCH_DIM_R                                      ~3      !0, 'email'
          4        ADD_ARRAY_ELEMENT                                ~2      ~3, 'email'
   41     5        FETCH_DIM_R                                      ~4      !0, 'banned'
          6        ADD_ARRAY_ELEMENT                                ~2      ~4, 'banned'
          7      > RETURN                                                   ~2
   43     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2nFlT%3A37%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.46 ms | 1400 KiB | 17 Q