3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/html; charset=UTF-8'); date_default_timezone_set('America/Los_Angeles'); echo memory_get_usage() . "\n"; $con = mysqli_connect("localhost", "***", "***", '***'); $result = mysqli_query($con,"SELECT * FROM **_streams"); while($row = mysqli_fetch_array($result)) { $json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($row['channel'])), true); if ($json_array['stream'] != NULL) { // turn them into variables to prevent outside SQL injection $displayname = mysqli_real_escape_string($con,$json_array['stream']['channel']['display_name']); $title = mysqli_real_escape_string($con,$json_array['stream']['channel']['status']); $game = mysqli_real_escape_string($con,$json_array['stream']['channel']['game']); $viewers = mysqli_real_escape_string($con,$json_array['stream']['viewers']); $preview = mysqli_real_escape_string($con,$json_array['stream']['preview']['medium']); $followers = mysqli_real_escape_string($con,$json_array['stream']['channel']['followers']); $date = date('m/d/Y h:i:s a', time()); mysqli_query($con,"SET NAMES utf8mb4"); mysqli_query($con,"UPDATE mybb_streams SET `online` = '1', `title` = '$title', `viewers` = '$viewers', `game` = '$game', `preview` = '$preview', `followers` = '$followers', `lastactive` = '$date' WHERE `channel` = '".strtolower($row['channel'])."'") or die("A MySQL error has occurred.<br />Your Query: UPDATE `streams` SET `online` = `1`, `title` = `$title`, `viewers` = `$viewers`, `game` = `$game`, `preview` = `$preview` WHERE channel = '".strtolower($row['channel'])."'<br /> Error: (" . mysqli_errno($con) . ") " . mysqli_error($con)); } else { mysqli_query($con,"UPDATE mybb_streams SET `online` = '0', `viewers` = '0' WHERE `channel` = '".strtolower($row['channel'])."'") or die("A MySQL error has occurred.<br />Your Query: UPDATE streams SET `online` = '0', `viewers` = '0' WHERE `channel` = '".strtolower($row['channel'])."'<br /> Error: (" . mysqli_errno($con) . ") " . mysqli_error($con)); } } echo memory_get_usage() . "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 182
Branch analysis from position: 182
2 jumps found. (Code = 44) Position 1 = 187, Position 2 = 23
Branch analysis from position: 187
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 154
Branch analysis from position: 39
2 jumps found. (Code = 47) Position 1 = 127, Position 2 = 153
Branch analysis from position: 127
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 153
1 jumps found. (Code = 42) Position 1 = 182
Branch analysis from position: 182
Branch analysis from position: 154
2 jumps found. (Code = 47) Position 1 = 165, Position 2 = 182
Branch analysis from position: 165
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 182
filename:       /in/3uQl4
function name:  (null)
number of ops:  192
compiled vars:  !0 = $con, !1 = $result, !2 = $json_array, !3 = $row, !4 = $displayname, !5 = $title, !6 = $game, !7 = $viewers, !8 = $preview, !9 = $followers, !10 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+text%2Fhtml%3B+charset%3DUTF-8'
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'date_default_timezone_set'
          4        SEND_VAL                                                 'America%2FLos_Angeles'
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $13     
          8        CONCAT                                           ~14     $13, '%0A'
          9        ECHO                                                     ~14
    7    10        INIT_FCALL_BY_NAME                                       'mysqli_connect'
         11        SEND_VAL_EX                                              'localhost'
         12        SEND_VAL_EX                                              '%2A%2A%2A'
         13        SEND_VAL_EX                                              '%2A%2A%2A'
         14        SEND_VAL_EX                                              '%2A%2A%2A'
         15        DO_FCALL                                      0  $15     
         16        ASSIGN                                                   !0, $15
    8    17        INIT_FCALL_BY_NAME                                       'mysqli_query'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAL_EX                                              'SELECT+%2A+FROM+%2A%2A_streams'
         20        DO_FCALL                                      0  $17     
         21        ASSIGN                                                   !1, $17
   10    22      > JMP                                                      ->182
   12    23    >   INIT_FCALL                                               'json_decode'
         24        INIT_FCALL                                               'file_get_contents'
         25        INIT_FCALL                                               'strtolower'
         26        FETCH_DIM_R                                      ~19     !3, 'channel'
         27        SEND_VAL                                                 ~19
         28        DO_ICALL                                         $20     
         29        CONCAT                                           ~21     'https%3A%2F%2Fapi.twitch.tv%2Fkraken%2Fstreams%2F', $20
         30        SEND_VAL                                                 ~21
         31        DO_ICALL                                         $22     
         32        SEND_VAR                                                 $22
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $23     
         35        ASSIGN                                                   !2, $23
   13    36        FETCH_DIM_R                                      ~25     !2, 'stream'
         37        IS_NOT_EQUAL                                             ~25, null
         38      > JMPZ                                                     ~26, ->154
   16    39    >   INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         40        SEND_VAR_EX                                              !0
         41        CHECK_FUNC_ARG                                           
         42        FETCH_DIM_FUNC_ARG                               $27     !2, 'stream'
         43        FETCH_DIM_FUNC_ARG                               $28     $27, 'channel'
         44        FETCH_DIM_FUNC_ARG                               $29     $28, 'display_name'
         45        SEND_FUNC_ARG                                            $29
         46        DO_FCALL                                      0  $30     
         47        ASSIGN                                                   !4, $30
   17    48        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         49        SEND_VAR_EX                                              !0
         50        CHECK_FUNC_ARG                                           
         51        FETCH_DIM_FUNC_ARG                               $32     !2, 'stream'
         52        FETCH_DIM_FUNC_ARG                               $33     $32, 'channel'
         53        FETCH_DIM_FUNC_ARG                               $34     $33, 'status'
         54        SEND_FUNC_ARG                                            $34
         55        DO_FCALL                                      0  $35     
         56        ASSIGN                                                   !5, $35
   18    57        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         58        SEND_VAR_EX                                              !0
         59        CHECK_FUNC_ARG                                           
         60        FETCH_DIM_FUNC_ARG                               $37     !2, 'stream'
         61        FETCH_DIM_FUNC_ARG                               $38     $37, 'channel'
         62        FETCH_DIM_FUNC_ARG                               $39     $38, 'game'
         63        SEND_FUNC_ARG                                            $39
         64        DO_FCALL                                      0  $40     
         65        ASSIGN                                                   !6, $40
   19    66        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         67        SEND_VAR_EX                                              !0
         68        CHECK_FUNC_ARG                                           
         69        FETCH_DIM_FUNC_ARG                               $42     !2, 'stream'
         70        FETCH_DIM_FUNC_ARG                               $43     $42, 'viewers'
         71        SEND_FUNC_ARG                                            $43
         72        DO_FCALL                                      0  $44     
         73        ASSIGN                                                   !7, $44
   20    74        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         75        SEND_VAR_EX                                              !0
         76        CHECK_FUNC_ARG                                           
         77        FETCH_DIM_FUNC_ARG                               $46     !2, 'stream'
         78        FETCH_DIM_FUNC_ARG                               $47     $46, 'preview'
         79        FETCH_DIM_FUNC_ARG                               $48     $47, 'medium'
         80        SEND_FUNC_ARG                                            $48
         81        DO_FCALL                                      0  $49     
         82        ASSIGN                                                   !8, $49
   21    83        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         84        SEND_VAR_EX                                              !0
         85        CHECK_FUNC_ARG                                           
         86        FETCH_DIM_FUNC_ARG                               $51     !2, 'stream'
         87        FETCH_DIM_FUNC_ARG                               $52     $51, 'channel'
         88        FETCH_DIM_FUNC_ARG                               $53     $52, 'followers'
         89        SEND_FUNC_ARG                                            $53
         90        DO_FCALL                                      0  $54     
         91        ASSIGN                                                   !9, $54
   22    92        INIT_FCALL                                               'date'
         93        SEND_VAL                                                 'm%2Fd%2FY+h%3Ai%3As+a'
         94        INIT_FCALL                                               'time'
         95        DO_ICALL                                         $56     
         96        SEND_VAR                                                 $56
         97        DO_ICALL                                         $57     
         98        ASSIGN                                                   !10, $57
   24    99        INIT_FCALL_BY_NAME                                       'mysqli_query'
        100        SEND_VAR_EX                                              !0
        101        SEND_VAL_EX                                              'SET+NAMES+utf8mb4'
        102        DO_FCALL                                      0          
   25   103        INIT_FCALL_BY_NAME                                       'mysqli_query'
        104        SEND_VAR_EX                                              !0
        105        ROPE_INIT                                    13  ~61     'UPDATE+mybb_streams+SET+%60online%60+%3D+%271%27%2C+%60title%60+%3D+%27'
        106        ROPE_ADD                                      1  ~61     ~61, !5
        107        ROPE_ADD                                      2  ~61     ~61, '%27%2C+%60viewers%60+%3D+%27'
        108        ROPE_ADD                                      3  ~61     ~61, !7
        109        ROPE_ADD                                      4  ~61     ~61, '%27%2C+%60game%60+%3D+%27'
        110        ROPE_ADD                                      5  ~61     ~61, !6
        111        ROPE_ADD                                      6  ~61     ~61, '%27%2C+%60preview%60+%3D+%27'
        112        ROPE_ADD                                      7  ~61     ~61, !8
        113        ROPE_ADD                                      8  ~61     ~61, '%27%2C+%60followers%60+%3D+%27'
        114        ROPE_ADD                                      9  ~61     ~61, !9
        115        ROPE_ADD                                     10  ~61     ~61, '%27%2C+%60lastactive%60+%3D+%27'
        116        ROPE_ADD                                     11  ~61     ~61, !10
        117        ROPE_END                                     12  ~60     ~61, '%27+WHERE+%60channel%60+%3D+%27'
        118        INIT_FCALL                                               'strtolower'
        119        FETCH_DIM_R                                      ~68     !3, 'channel'
        120        SEND_VAL                                                 ~68
        121        DO_ICALL                                         $69     
        122        CONCAT                                           ~70     ~60, $69
        123        CONCAT                                           ~71     ~70, '%27'
        124        SEND_VAL_EX                                              ~71
        125        DO_FCALL                                      0  $72     
        126      > JMPNZ_EX                                         ~73     $72, ->153
        127    >   ROPE_INIT                                     9  ~75     'A+MySQL+error+has+occurred.%3Cbr+%2F%3EYour+Query%3A+UPDATE+%60streams%60+SET+%60online%60+%3D+%601%60%2C+%60title%60+%3D+%60'
        128        ROPE_ADD                                      1  ~75     ~75, !5
        129        ROPE_ADD                                      2  ~75     ~75, '%60%2C+%60viewers%60+%3D+%60'
        130        ROPE_ADD                                      3  ~75     ~75, !7
        131        ROPE_ADD                                      4  ~75     ~75, '%60%2C+%60game%60+%3D+%60'
        132        ROPE_ADD                                      5  ~75     ~75, !6
        133        ROPE_ADD                                      6  ~75     ~75, '%60%2C+%60preview%60+%3D+%60'
        134        ROPE_ADD                                      7  ~75     ~75, !8
        135        ROPE_END                                      8  ~74     ~75, '%60+WHERE+channel+%3D+%27'
        136        INIT_FCALL                                               'strtolower'
        137        FETCH_DIM_R                                      ~80     !3, 'channel'
        138        SEND_VAL                                                 ~80
        139        DO_ICALL                                         $81     
        140        CONCAT                                           ~82     ~74, $81
        141        CONCAT                                           ~83     ~82, '%27%3Cbr+%2F%3E+Error%3A+%28'
        142        INIT_FCALL_BY_NAME                                       'mysqli_errno'
        143        SEND_VAR_EX                                              !0
        144        DO_FCALL                                      0  $84     
        145        CONCAT                                           ~85     ~83, $84
        146        CONCAT                                           ~86     ~85, '%29+'
        147        INIT_FCALL_BY_NAME                                       'mysqli_error'
        148        SEND_VAR_EX                                              !0
        149        DO_FCALL                                      0  $87     
        150        CONCAT                                           ~88     ~86, $87
        151      > EXIT                                                     ~88
        152*       BOOL                                             ~73     <true>
        153    > > JMP                                                      ->182
   29   154    >   INIT_FCALL_BY_NAME                                       'mysqli_query'
        155        SEND_VAR_EX                                              !0
        156        INIT_FCALL                                               'strtolower'
        157        FETCH_DIM_R                                      ~89     !3, 'channel'
        158        SEND_VAL                                                 ~89
        159        DO_ICALL                                         $90     
        160        CONCAT                                           ~91     'UPDATE+mybb_streams+SET+%60online%60+%3D+%270%27%2C+%60viewers%60+%3D+%270%27+WHERE+%60channel%60+%3D+%27', $90
        161        CONCAT                                           ~92     ~91, '%27'
        162        SEND_VAL_EX                                              ~92
        163        DO_FCALL                                      0  $93     
        164      > JMPNZ_EX                                         ~94     $93, ->182
        165    >   INIT_FCALL                                               'strtolower'
        166        FETCH_DIM_R                                      ~95     !3, 'channel'
        167        SEND_VAL                                                 ~95
        168        DO_ICALL                                         $96     
        169        CONCAT                                           ~97     'A+MySQL+error+has+occurred.%3Cbr+%2F%3EYour+Query%3A+UPDATE+streams+SET+%60online%60+%3D+%270%27%2C+%60viewers%60+%3D+%270%27+WHERE+%60channel%60+%3D+%27', $96
        170        CONCAT                                           ~98     ~97, '%27%3Cbr+%2F%3E+Error%3A+%28'
        171        INIT_FCALL_BY_NAME                                       'mysqli_errno'
        172        SEND_VAR_EX                                              !0
        173        DO_FCALL                                      0  $99     
        174        CONCAT                                           ~100    ~98, $99
        175        CONCAT                                           ~101    ~100, '%29+'
        176        INIT_FCALL_BY_NAME                                       'mysqli_error'
        177        SEND_VAR_EX                                              !0
        178        DO_FCALL                                      0  $102    
        179        CONCAT                                           ~103    ~101, $102
        180      > EXIT                                                     ~103
        181*       BOOL                                             ~94     <true>
   10   182    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
        183        SEND_VAR_EX                                              !1
        184        DO_FCALL                                      0  $104    
        185        ASSIGN                                           ~105    !3, $104
        186      > JMPNZ                                                    ~105, ->23
   34   187    >   INIT_FCALL                                               'memory_get_usage'
        188        DO_ICALL                                         $106    
        189        CONCAT                                           ~107    $106, '%0A'
        190        ECHO                                                     ~107
   36   191      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.64 ms | 1404 KiB | 29 Q