3v4l.org

run code in 500+ PHP versions simultaneously
<?php $fileContents = <<<TEXT 1|2 2|6 3|8 4|3 5|10 TEXT; $_GET['candidate'] = '4'; if (isset($_GET['candidate'])) { $fileContents = preg_replace_callback( '~^' . (int)$_GET['candidate'] . '\|\K\d+~m', function($m) { return ++$m[0]; }, $fileContents ); echo "New total: " . array_sum(preg_match_all('~\|\K\d+~', $fileContents, $m) ? $m[0] : []); echo "\n---\n"; echo $fileContents; //file_put_contents('results.txt', $fileContents); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 36
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/UosfQ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $fileContents, !1 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '1%7C2%0A2%7C6%0A3%7C8%0A4%7C3%0A5%7C10'
   11     1        FETCH_W                          global              $3      '_GET'
          2        ASSIGN_DIM                                                   $3, 'candidate'
          3        OP_DATA                                                      '4'
   12     4        FETCH_IS                                             ~5      '_GET'
          5        ISSET_ISEMPTY_DIM_OBJ                             0          ~5, 'candidate'
          6      > JMPZ                                                         ~6, ->36
   13     7    >   INIT_FCALL                                                   'preg_replace_callback'
   14     8        FETCH_R                          global              ~7      '_GET'
          9        FETCH_DIM_R                                          ~8      ~7, 'candidate'
         10        CAST                                              4  ~9      ~8
         11        CONCAT                                               ~10     '%7E%5E', ~9
         12        CONCAT                                               ~11     ~10, '%5C%7C%5CK%5Cd%2B%7Em'
         13        SEND_VAL                                                     ~11
   15    14        DECLARE_LAMBDA_FUNCTION                              ~12     [0]
   17    15        SEND_VAL                                                     ~12
   18    16        SEND_VAR                                                     !0
   13    17        DO_ICALL                                             $13     
         18        ASSIGN                                                       !0, $13
   20    19        INIT_FCALL                                                   'array_sum'
         20        INIT_FCALL                                                   'preg_match_all'
         21        SEND_VAL                                                     '%7E%5C%7C%5CK%5Cd%2B%7E'
         22        SEND_VAR                                                     !0
         23        SEND_REF                                                     !1
         24        DO_ICALL                                             $15     
         25      > JMPZ                                                         $15, ->29
         26    >   FETCH_DIM_R                                          ~16     !1, 0
         27        QM_ASSIGN                                            ~17     ~16
         28      > JMP                                                          ->30
         29    >   QM_ASSIGN                                            ~17     <array>
         30    >   SEND_VAL                                                     ~17
         31        DO_ICALL                                             $18     
         32        CONCAT                                               ~19     'New+total%3A+', $18
         33        ECHO                                                         ~19
   21    34        ECHO                                                         '%0A---%0A'
   22    35        ECHO                                                         !0
   24    36    > > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UosfQ
function name:  {closure:/in/UosfQ:15}
number of ops:  5
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
   16     1        FETCH_DIM_RW                                         $1      !0, 0
          2        PRE_INC                                              ~2      $1
          3      > RETURN                                                       ~2
   17     4*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.73 ms | 2005 KiB | 16 Q