3v4l.org

run code in 300+ PHP versions simultaneously
<?php $state_id = ''; $zone_id = ''; $postcode = ''; $postcode_required = ''; function validate($state_id,$zone_id,$postcode,$postcode_required) { $message = array( 'warning' => 'Warning: No Shipping options are available. Please contact us for assistance!', 'state' => 'Please select a state!', 'zone' => 'Please select a city / area!', 'postcode' => 'Postcode must be between 4 and 10 characters!' ); $delivery_quites = array('state' => $state_id, 'zone' =>$zone_id, 'postcode'=>$postcode, 'postcode_required'=>$postcode_required ); $data = ''; foreach($delivery_quites as $key => $value){ if ($value['state'] =''){ $data['state'] = $message[$key]; } if ($value['zone'] =''){ $data['zone'] = $message['zone']; } } return $data; } $test = validate($state_id,$zone_id,$postcode,$postcode_required); print_r(json_encode(array('error' => $test))); //print_r($delivery_quites);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTjKv
function name:  (null)
number of ops:  19
compiled vars:  !0 = $state_id, !1 = $zone_id, !2 = $postcode, !3 = $postcode_required, !4 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, ''
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, ''
    5     3        ASSIGN                                                   !3, ''
   35     4        INIT_FCALL                                               'validate'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !3
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !4, $9
   36    11        INIT_FCALL                                               'print_r'
         12        INIT_FCALL                                               'json_encode'
         13        INIT_ARRAY                                       ~11     !4, 'error'
         14        SEND_VAL                                                 ~11
         15        DO_ICALL                                         $12     
         16        SEND_VAR                                                 $12
         17        DO_ICALL                                                 
   37    18      > RETURN                                                   1

Function validate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 26
Branch analysis from position: 20
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/qTjKv
function name:  validate
number of ops:  30
compiled vars:  !0 = $state_id, !1 = $zone_id, !2 = $postcode, !3 = $postcode_required, !4 = $message, !5 = $delivery_quites, !6 = $data, !7 = $value, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    9     4        ASSIGN                                                   !4, <array>
   16     5        INIT_ARRAY                                       ~10     !0, 'state'
          6        ADD_ARRAY_ELEMENT                                ~10     !1, 'zone'
          7        ADD_ARRAY_ELEMENT                                ~10     !2, 'postcode'
          8        ADD_ARRAY_ELEMENT                                ~10     !3, 'postcode_required'
          9        ASSIGN                                                   !5, ~10
   19    10        ASSIGN                                                   !6, ''
   21    11      > FE_RESET_R                                       $13     !5, ->27
         12    > > FE_FETCH_R                                       ~14     $13, !7, ->27
         13    >   ASSIGN                                                   !8, ~14
   22    14        ASSIGN_DIM                                       ~16     !7, 'state'
         15        OP_DATA                                                  ''
         16      > JMPZ                                                     ~16, ->20
   23    17    >   FETCH_DIM_R                                      ~18     !4, !8
         18        ASSIGN_DIM                                               !6, 'state'
         19        OP_DATA                                                  ~18
   25    20    >   ASSIGN_DIM                                       ~19     !7, 'zone'
         21        OP_DATA                                                  ''
         22      > JMPZ                                                     ~19, ->26
   26    23    >   FETCH_DIM_R                                      ~21     !4, 'zone'
         24        ASSIGN_DIM                                               !6, 'zone'
         25        OP_DATA                                                  ~21
   21    26    > > JMP                                                      ->12
         27    >   FE_FREE                                                  $13
   31    28      > RETURN                                                   !6
   33    29*     > RETURN                                                   null

End of function validate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.99 ms | 1403 KiB | 18 Q