3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* String to print for an error where a parameter is missing from the post */ const ERROR_MISSING_PARAM = "10000"; $errors = array(); $number_of_errors = 0; function addError($error, $variable){ $errors[$variable] = $error; $number_of_errors = count($errors); } function printToJson(){ return json_encode($this->errors); } addError(ERROR_MISSING_PARAM, 'name'); echo $number_of_errors . "\r\n"; echo printToJson();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bu5a7
function name:  (null)
number of ops:  14
compiled vars:  !0 = $errors, !1 = $number_of_errors
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CONST                                            'ERROR_MISSING_PARAM', '10000'
    7     1        ASSIGN                                                   !0, <array>
    8     2        ASSIGN                                                   !1, 0
   20     3        INIT_FCALL                                               'adderror'
          4        FETCH_CONSTANT                                   ~4      'ERROR_MISSING_PARAM'
          5        SEND_VAL                                                 ~4
          6        SEND_VAL                                                 'name'
          7        DO_FCALL                                      0          
   21     8        CONCAT                                           ~6      !1, '%0D%0A'
          9        ECHO                                                     ~6
   22    10        INIT_FCALL                                               'printtojson'
         11        DO_FCALL                                      0  $7      
         12        ECHO                                                     $7
         13      > RETURN                                                   1

Function adderror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bu5a7
function name:  addError
number of ops:  7
compiled vars:  !0 = $error, !1 = $variable, !2 = $errors, !3 = $number_of_errors
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        ASSIGN_DIM                                               !2, !1
          3        OP_DATA                                                  !0
   13     4        COUNT                                            ~5      !2
          5        ASSIGN                                                   !3, ~5
   14     6      > RETURN                                                   null

End of function adderror

Function printtojson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bu5a7
function name:  printToJson
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'json_encode'
          1        FETCH_THIS                                       $0      
          2        FETCH_OBJ_R                                      ~1      $0, 'errors'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
   18     6*     > RETURN                                                   null

End of function printtojson

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.86 ms | 1399 KiB | 17 Q