3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'name' => 'Electric Khodro', 'price' => 12912 ], [ 'name' => 'Iran Khodro', 'price' => 15218 ], [ 'name' => 'Iran arghaam', 'price' => 8853 ] , // ... ]; function getHighestPrice($data,$name){ $prices = array_column($data,$name); return $prices == [] ? NULL : max($prices); } $maxPrice = getHighestPrice($data,'price'); echo $maxPrice;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UCBJX
function name:  (null)
number of ops:  8
compiled vars:  !0 = $data, !1 = $maxPrice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        INIT_FCALL                                               'gethighestprice'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'price'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   28     6        ECHO                                                     !1
   29     7      > RETURN                                                   1

Function gethighestprice:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UCBJX
function name:  getHighestPrice
number of ops:  17
compiled vars:  !0 = $data, !1 = $name, !2 = $prices
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
   23     7        IS_EQUAL                                                 !2, <array>
          8      > JMPZ                                                     ~5, ->11
          9    >   QM_ASSIGN                                        ~6      null
         10      > JMP                                                      ->15
         11    >   INIT_FCALL                                               'max'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $7      
         14        QM_ASSIGN                                        ~6      $7
         15    > > RETURN                                                   ~6
   24    16*     > RETURN                                                   null

End of function gethighestprice

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
347.8 ms | 1018 KiB | 16 Q