3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create connection $con=mysqli_connect('localhost','root','root','Test_DB'); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // This SQL statement selects ALL from the table 'Locations' $sql = "SELECT * FROM Locations"; // Check if there are results if ($result = mysqli_query($con, $sql)) { // If so, then create a results array and a temporary one // to hold the data $resultArray = array(); $tempArray = array(); // Loop through each row in the result set while($row = $result->fetch_object()) { // Add each row into our results array $tempArray = $row; array_push($resultArray, $tempArray); } // Finally, encode the array to JSON and output the results echo json_encode($resultArray); } // Close connections mysqli_close($con); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 37
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
Branch analysis from position: 24
Branch analysis from position: 37
Branch analysis from position: 14
filename:       /in/mhFEk
function name:  (null)
number of ops:  41
compiled vars:  !0 = $con, !1 = $sql, !2 = $result, !3 = $resultArray, !4 = $tempArray, !5 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL_BY_NAME                                       'mysqli_connect'
          1        SEND_VAL_EX                                              'localhost'
          2        SEND_VAL_EX                                              'root'
          3        SEND_VAL_EX                                              'root'
          4        SEND_VAL_EX                                              'Test_DB'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !0, $6
    7     7        INIT_FCALL_BY_NAME                                       'mysqli_connect_errno'
          8        DO_FCALL                                      0  $8      
          9      > JMPZ                                                     $8, ->14
    9    10    >   INIT_FCALL_BY_NAME                                       'mysqli_connect_error'
         11        DO_FCALL                                      0  $9      
         12        CONCAT                                           ~10     'Failed+to+connect+to+MySQL%3A+', $9
         13        ECHO                                                     ~10
   13    14    >   ASSIGN                                                   !1, 'SELECT+%2A+FROM+Locations'
   16    15        INIT_FCALL_BY_NAME                                       'mysqli_query'
         16        SEND_VAR_EX                                              !0
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0  $12     
         19        ASSIGN                                           ~13     !2, $12
         20      > JMPZ                                                     ~13, ->37
   20    21    >   ASSIGN                                                   !3, <array>
   21    22        ASSIGN                                                   !4, <array>
   24    23      > JMP                                                      ->29
   27    24    >   ASSIGN                                                   !4, !5
   28    25        INIT_FCALL                                               'array_push'
         26        SEND_REF                                                 !3
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                                 
   24    29    >   INIT_METHOD_CALL                                         !2, 'fetch_object'
         30        DO_FCALL                                      0  $18     
         31        ASSIGN                                           ~19     !5, $18
         32      > JMPNZ                                                    ~19, ->24
   32    33    >   INIT_FCALL                                               'json_encode'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                         $20     
         36        ECHO                                                     $20
   36    37    >   INIT_FCALL_BY_NAME                                       'mysqli_close'
         38        SEND_VAR_EX                                              !0
         39        DO_FCALL                                      0          
   37    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.16 ms | 1400 KiB | 17 Q