3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hugeArrayOfStuffThatIsParsedLater = []; function functionThatReturnsStringOrEmptyString(string $query): string { return determineIfThisExists($query) ?? ''; } function determineIfThisExists(string $string): ?string { return mt_rand(1, 2) === 1 ? $string : ''; } $hugeArrayOfStuffThatIsParsedLater['anIndex'] = 'Music'; functionThatReturnsStringOrEmptyString('rocks') !== '' ? $hugeArrayOfStuffThatIsParsedLater['anIndex'] .= ' ' . functionThatReturnsStringOrEmptyString('rocks') : null; var_dump($hugeArrayOfStuffThatIsParsedLater['anIndex']);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a7nq7
function name:  (null)
number of ops:  23
compiled vars:  !0 = $hugeArrayOfStuffThatIsParsedLater
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN_DIM                                               !0, 'anIndex'
          2        OP_DATA                                                  'Music'
   17     3        INIT_FCALL                                               'functionthatreturnsstringoremptystring'
          4        SEND_VAL                                                 'rocks'
          5        DO_FCALL                                      0  $3      
          6        IS_NOT_IDENTICAL                                         $3, ''
          7      > JMPZ                                                     ~4, ->16
          8    >   INIT_FCALL                                               'functionthatreturnsstringoremptystring'
          9        SEND_VAL                                                 'rocks'
         10        DO_FCALL                                      0  $6      
         11        CONCAT                                           ~7      '+', $6
         12        ASSIGN_DIM_OP                .=               8  ~5      !0, 'anIndex'
         13        OP_DATA                                                  ~7
         14        QM_ASSIGN                                        ~8      ~5
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~8      null
         17    >   FREE                                                     ~8
   19    18        INIT_FCALL                                               'var_dump'
         19        FETCH_DIM_R                                      ~9      !0, 'anIndex'
         20        SEND_VAL                                                 ~9
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function functionthatreturnsstringoremptystring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a7nq7
function name:  functionThatReturnsStringOrEmptyString
number of ops:  10
compiled vars:  !0 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL_BY_NAME                                       'determineIfThisExists'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        COALESCE                                         ~2      $1
          5        QM_ASSIGN                                        ~2      ''
          6        VERIFY_RETURN_TYPE                                       ~2
          7      > RETURN                                                   ~2
    8     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function functionthatreturnsstringoremptystring

Function determineifthisexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a7nq7
function name:  determineIfThisExists
number of ops:  14
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'mt_rand'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                             $1, 1
          6      > JMPZ                                                     ~2, ->9
          7    >   QM_ASSIGN                                        ~3      !0
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~3      ''
         10    >   VERIFY_RETURN_TYPE                                       ~3
         11      > RETURN                                                   ~3
   13    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function determineifthisexists

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.85 ms | 1008 KiB | 17 Q