3v4l.org

run code in 500+ PHP versions simultaneously
<?php $category = array( 'Account' => array( 'Show Balance' => array( 'Recharge' => 2300, 'Success' => 12000, 'Failure' => 25000, ), 'Balance History' => 'your balance is very low for last 2 years', 'Mini Statement' => 'This is your mini statement. You can have a look of your transaction details', 'Last Transaction' => 25000 ), 'Deposit' => array( 'Deposit Limit' => 40000, 'Make Deposit' => 'Please go to the nearest branch ans deposit the money.', 'Last Deposit' => 12000 ), 'FAQ' => array( 'How To Open An Account' => 'Go to your nearest branch fill up a form, submit it to the branch manger with required supporting documents.', 'How To Widraw Money' => 'Go to any atm center swipe the card enter pin and get your money.', 'How To Add Money' => 'You need to go to your nearest branch and deposit money over there.' ), 'Loan' => array( 'Home Loan' => 'This is home loan related answer', 'Personal Loan' => 'This is personal loan related answer', 'Car Loan' => 'This is car loan related answer', 'Bike Loan' => 'This is bike loan related answer' ) , 'Test', ); function getData($categoryArray, $key){ foreach($categoryArray as $k => $value){ if($k==$key) return $value; if(is_array($value)){ $find = getData($value, $key); if($find){ return $find; } } } return null; } $result1 = getData($category, 'Show Balance'); var_dump($result1); $result = getData($category, 'Recharge'); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kEOZI
function name:  (null)
number of ops:  18
compiled vars:  !0 = $category, !1 = $result1, !2 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   48     1        INIT_FCALL                                                   'getdata'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     'Show+Balance'
          4        DO_FCALL                                          0  $4      
          5        ASSIGN                                                       !1, $4
   49     6        INIT_FCALL                                                   'var_dump'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                                     
   50     9        INIT_FCALL                                                   'getdata'
         10        SEND_VAR                                                     !0
         11        SEND_VAL                                                     'Recharge'
         12        DO_FCALL                                          0  $7      
         13        ASSIGN                                                       !2, $7
   51    14        INIT_FCALL                                                   'var_dump'
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Function getdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/kEOZI
function name:  getData
number of ops:  23
compiled vars:  !0 = $categoryArray, !1 = $key, !2 = $value, !3 = $k, !4 = $find
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   36     2      > FE_RESET_R                                           $5      !0, ->20
          3    > > FE_FETCH_R                                           ~6      $5, !2, ->20
          4    >   ASSIGN                                                       !3, ~6
   37     5        IS_EQUAL                                                     !3, !1
          6      > JMPZ                                                         ~8, ->9
          7    >   FE_FREE                                                      $5
          8      > RETURN                                                       !2
   38     9    >   TYPE_CHECK                                      128          !2
         10      > JMPZ                                                         ~9, ->19
   39    11    >   INIT_FCALL_BY_NAME                                           'getData'
         12        SEND_VAR_EX                                                  !2
         13        SEND_VAR_EX                                                  !1
         14        DO_FCALL                                          0  $10     
         15        ASSIGN                                                       !4, $10
   40    16      > JMPZ                                                         !4, ->19
   41    17    >   FE_FREE                                                      $5
         18      > RETURN                                                       !4
   36    19    > > JMP                                                          ->3
         20    >   FE_FREE                                                      $5
   45    21      > RETURN                                                       null
   46    22*     > RETURN                                                       null

End of function getdata

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.43 ms | 2636 KiB | 15 Q