3v4l.org

run code in 300+ PHP versions simultaneously
<?php $responseCode = 0; function validate($n) { return $n; } function responseFromCode($code) { if ($code == 100) { return '{"status":100, "status_text":"Invalid User"}'; } if ($code == 200) { return '{"status":200, "status_text":"Invalid Company"}'; } if ($code == 300) { return '{"status":300, "status_text":"Feature Not enabled"}'; } return '{"status":400, "status_text":"Internal Error"}'; } $responseCode=validate(100); echo $responseCode; if ($responseCode != 1) { echo jsonresponseFromCode($responseCode); } else { echo "validated"; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PAXQW
function name:  (null)
number of ops:  15
compiled vars:  !0 = $responseCode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 0
   22     1        INIT_FCALL                                               'validate'
          2        SEND_VAL                                                 100
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   23     5        ECHO                                                     !0
   24     6        IS_NOT_EQUAL                                             !0, 1
          7      > JMPZ                                                     ~4, ->13
   25     8    >   INIT_FCALL_BY_NAME                                       'jsonresponseFromCode'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $5      
         11        ECHO                                                     $5
         12      > JMP                                                      ->14
   27    13    >   ECHO                                                     'validated'
   30    14    > > RETURN                                                   1

Function validate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PAXQW
function name:  validate
number of ops:  3
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1      > RETURN                                                   !0
    7     2*     > RETURN                                                   null

End of function validate

Function responsefromcode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PAXQW
function name:  responseFromCode
number of ops:  12
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        IS_EQUAL                                                 !0, 100
          2      > JMPZ                                                     ~1, ->4
   11     3    > > RETURN                                                   '%7B%22status%22%3A100%2C+%22status_text%22%3A%22Invalid+User%22%7D'
   13     4    >   IS_EQUAL                                                 !0, 200
          5      > JMPZ                                                     ~2, ->7
   14     6    > > RETURN                                                   '%7B%22status%22%3A200%2C+%22status_text%22%3A%22Invalid+Company%22%7D'
   16     7    >   IS_EQUAL                                                 !0, 300
          8      > JMPZ                                                     ~3, ->10
   17     9    > > RETURN                                                   '%7B%22status%22%3A300%2C+%22status_text%22%3A%22Feature+Not+enabled%22%7D'
   19    10    > > RETURN                                                   '%7B%22status%22%3A400%2C+%22status_text%22%3A%22Internal+Error%22%7D'
   20    11*     > RETURN                                                   null

End of function responsefromcode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.38 ms | 1403 KiB | 14 Q