3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $clientNumber = '100'; $supportNumber = '22123322'; $countryCode = 'GB'; $db = new MySQLi('dbmaster', 'user', 'pass', 'dbname'); $existingResult = $db->query(sprintf( "SELECT `id` FROM `calls_queue` WHERE `client_number` = '%s' AND `support_number` = '%s' AND `status` = 0", $clientNumber, $supportNumber )); if ($existingResult && $existingResult->num_rows) { $call = $existingResult->fetch_assoc(); $result = $db->query(sprintf("UPDATE `calls_queue` SET `calls` = `calls` + 1 WHERE `id` = %d", $call['id'])); } else { $result = $db->query(sprintf( "INSERT INTO `calls_queue` (`client_number`, `support_number`, `country_code`, `calls`) VALUES ('%s', '%s', '%s', 1)", $clientNumber, $supportNumber, $countryCode )); }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
Jump found. Position 1 = 23, Position 2 = 36
Branch analysis from position: 23
Jump found. Position 1 = 46
Branch analysis from position: 46
Jump found. Position 1 = -2
Branch analysis from position: 36
Jump found. Position 1 = -2
Branch analysis from position: 22
filename:       /in/f2B0U
function name:  (null)
number of ops:  47
compiled vars:  !0 = $clientNumber, !1 = $supportNumber, !2 = $countryCode, !3 = $db, !4 = $existingResult, !5 = $call, !6 = $result
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, '100'
   4     1        ASSIGN                                                   !1, '22123322'
   5     2        ASSIGN                                                   !2, 'GB'
   7     3        NEW                                              $10     :-3
         4        SEND_VAL_EX                                              'dbmaster'
         5        SEND_VAL_EX                                              'user'
         6        SEND_VAL_EX                                              'pass'
         7        SEND_VAL_EX                                              'dbname'
         8        DO_FCALL                                      0          
         9        ASSIGN                                                   !3, $10
   9    10        INIT_METHOD_CALL                                         !3, 'query'
        11        INIT_FCALL                                               'sprintf'
  10    12        SEND_VAL                                                 'SELECT+%60id%60+FROM+%60calls_queue%60+WHERE+%60client_number%60+%3D+%27%25s%27+AND+%60support_number%60+%3D+%27%25s%27+AND+%60status%60+%3D+0'
        13        SEND_VAR                                                 !0
        14        SEND_VAR                                                 !1
        15        DO_ICALL                                         $13     
        16        SEND_VAR_NO_REF                               4          $13
        17        DO_FCALL                                      0  $14     
        18        ASSIGN                                                   !4, $14
  15    19      > JMPZ_EX                                          ~16     !4, ->22
        20    >   FETCH_OBJ_R                                      $17     !4, 'num_rows'
        21        BOOL                                             ~16     $17
        22    > > JMPZ                                                     ~16, ->36
  16    23    >   INIT_METHOD_CALL                                         !4, 'fetch_assoc'
        24        DO_FCALL                                      0  $18     
        25        ASSIGN                                                   !5, $18
  17    26        INIT_METHOD_CALL                                         !3, 'query'
        27        INIT_FCALL                                               'sprintf'
        28        SEND_VAL                                                 'UPDATE+%60calls_queue%60+SET+%60calls%60+%3D+%60calls%60+%2B+1+WHERE+%60id%60+%3D+%25d'
        29        FETCH_DIM_R                                      $20     !5, 'id'
        30        SEND_VAR                                                 $20
        31        DO_ICALL                                         $21     
        32        SEND_VAR_NO_REF                               4          $21
        33        DO_FCALL                                      0  $22     
        34        ASSIGN                                                   !6, $22
        35      > JMP                                                      ->46
  19    36    >   INIT_METHOD_CALL                                         !3, 'query'
        37        INIT_FCALL                                               'sprintf'
  20    38        SEND_VAL                                                 'INSERT+INTO+%60calls_queue%60+%28%60client_number%60%2C+%60support_number%60%2C+%60country_code%60%2C+%60calls%60%29+VALUES+%28%27%25s%27%2C+%27%25s%27%2C+%27%25s%27%2C+1%29'
        39        SEND_VAR                                                 !0
        40        SEND_VAR                                                 !1
        41        SEND_VAR                                                 !2
        42        DO_ICALL                                         $24     
        43        SEND_VAR_NO_REF                               4          $24
        44        DO_FCALL                                      0  $25     
        45        ASSIGN                                                   !6, $25
        46    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.1.0