3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total = array(); $total[] = array( "id" => 1, "account" => "hello world", "item" => "package", "quantity" => 10 ); $total[] = array( "id" => 2, "account" => "foo", "item" => "world", "quantity" => 100 ); $maxtotal; foreach ($total as $key => $value) { // $value is an array() with id, account, item, quantity $maxtotal = array_search( max($value), $value); // doesn't work } print_r( $maxtotal ); // should print out the array with id=2
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/HqtrL
function name:  (null)
number of ops:  22
compiled vars:  !0 = $total, !1 = $maxtotal, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0
    5     2        OP_DATA                                                  <array>
   10     3        ASSIGN_DIM                                               !0
   11     4        OP_DATA                                                  <array>
   18     5      > FE_RESET_R                                       $7      !0, ->17
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->17
          7    >   ASSIGN                                                   !3, ~8
   20     8        INIT_FCALL                                               'array_search'
          9        INIT_FCALL                                               'max'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        SEND_VAR                                                 $10
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !1, $11
   18    16      > JMP                                                      ->6
         17    >   FE_FREE                                                  $7
   23    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.56 ms | 1395 KiB | 19 Q