3v4l.org

run code in 300+ PHP versions simultaneously
<?php $links = array ( 0 => array ( 'rel' => 'advertisements', 'href' => 'https://api.teamsnap.com/v3/advertisements' ), 1 => array ( 'rel' => 'active_season_team', 'href' => 'https://api.teamsnap.com/v3/teams' ), 2 => array ( 'rel' => 'assignments', 'href' => 'https://api.teamsnap.com/v3/assignments' ), 3 => array ( 'rel' => 'availabilities', 'href' => 'https://api.teamsnap.com/v3/availabilities' ) ); function get_link($links, $cat) { if(($key = array_search($cat, array_column($links, 'rel'))) !== false) { return $links[$key]['href']; } else { return ''; } } echo get_link($links, 'active_season_team');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmQ6d
function name:  (null)
number of ops:  7
compiled vars:  !0 = $links
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'get_link'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'active_season_team'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function get_link:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmQ6d
function name:  get_link
number of ops:  19
compiled vars:  !0 = $links, !1 = $cat, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        INIT_FCALL                                               'array_search'
          3        SEND_VAR                                                 !1
          4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'rel'
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                         $4      
         10        ASSIGN                                           ~5      !2, $4
         11        TYPE_CHECK                                  1018          ~5
         12      > JMPZ                                                     ~6, ->17
   28    13    >   FETCH_DIM_R                                      ~7      !0, !2
         14        FETCH_DIM_R                                      ~8      ~7, 'href'
         15      > RETURN                                                   ~8
   27    16*       JMP                                                      ->18
   31    17    > > RETURN                                                   ''
   33    18*     > RETURN                                                   null

End of function get_link

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.56 ms | 1004 KiB | 16 Q