3v4l.org

run code in 300+ PHP versions simultaneously
<?php $links = array ('http://yandex.ru/','http://google.com/','http://rambler.ru','http://www.mail.ru/','http://yahoo.com/', 'http://msn.com/','http://www.yellowpages.ru/', 'http://www.liveinternet.ru/', 'http://www.lenta.ru/','http://www.3.org/' ); function MyCount() { global $links; $file='count.txt'; if(!file_exists($file)){$fp = fopen($file, "w");fwrite($fp,'0');fclose($fp);} $k=(int)file_get_contents($file); $z=$k+1; $countf=fopen($file,"r+"); flock($countf,2); fputs($countf,$z); fclose($countf); $z=($k % count($links)); if ($z==0){$z=count($links);}else {$z=$z-1;} return $z; } function MyList($k) { global $links; $z= count($links)-$k; if ($z<5) { $links2=array_slice($links,($k),$z,true)+array_slice($links,0,(5-$z),true); } else { $links2=array_slice($links,$k,5,true); } return $links2; } function MyListToHTML($list) { $out=''; foreach ($list as $key => $value) { $key2=$key+1; $out.='<tr><th><input id="'.$key2.'" name="'.$key.'" type=checkbox><th><label for="'.$key2.'">'.$value.'</label></tr>'; } return $out; } ?> <html> <head> <script type="text/javascript"> var x;var y; function t(i){return (i<10)?"0"+i:i;} function z(){ var e = new Date(); window.status=t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+" x= "+x+", y= "+y; setTimeout('z()',1); } document.onmousemove=function(){x=event.x;y=event.y;} function s(){ var k=false; var nodeList = document.getElementsByTagName('input'); for (var i = 0; i < nodeList.length; i++) { if(nodeList[i].getAttribute("type") =="checkbox") { if (nodeList[i].checked==true) { k=true; } } } if(!k){alert('Ничего не выбрано');} return k; } </script></head> <body onLoad="z()"> <?php if(isset($_POST['submitMe'])) { echo("Вами были выбраны следующие ссылки:<br>"); foreach ($_POST as $key => $value) { if ($value=='on') echo '<a href="'.$links[$key].'">'.$links[$key].'</a><br>'; } } else { ?> <form name='MyList' method="POST" action="<?=$_SERVER['PHP_SELF']?>" onsubmit="return s();"> <table border=all><col align=center><col align=left> <?php echo MyListToHTML(Mylist(MyCount()));; ?> <tr><th>&nbsp;<th><input type=submit name="submitMe" value="Oк" style="width:200px;"></tr> </table> </form> <? } ?> </body></html> $end
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3UKqj
function name:  (null)
number of ops:  39
compiled vars:  !0 = $links, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   53     1        ECHO                                                     '%3Chtml%3E%0A%3Chead%3E%0A%3Cscript+type%3D%22text%2Fjavascript%22%3E%0Avar+x%3Bvar+y%3B%0A%0Afunction+t%28i%29%7Breturn+%28i%3C10%29%3F%220%22%2Bi%3Ai%3B%7D%0A%0Afunction+z%28%29%7B%0Avar+e+%3D+new+Date%28%29%3B%0Awindow.status%3Dt%28e.getHours%28%29%29%2B%22%3A%22%2Bt%28e.getMinutes%28%29%29%2B%22%3A%22%2Bt%28e.getSeconds%28%29%29%2B%22+x%3D+%22%2Bx%2B%22%2C+y%3D+%22%2By%3B%0AsetTimeout%28%27z%28%29%27%2C1%29%3B%0A%7D%0A%0Adocument.onmousemove%3Dfunction%28%29%7Bx%3Devent.x%3By%3Devent.y%3B%7D%0A%0Afunction+s%28%29%7B%0Avar+k%3Dfalse%3B%0Avar+nodeList+%3D+document.getElementsByTagName%28%27input%27%29%3B%0Afor+%28var+i+%3D+0%3B+i+%3C+nodeList.length%3B+i%2B%2B%29+%0A%7B%0A%09if%28nodeList%5Bi%5D.getAttribute%28%22type%22%29+%3D%3D%22checkbox%22%29%0A%09%7B%0A++++++++%09if+%28nodeList%5Bi%5D.checked%3D%3Dtrue%29%0A%09%09%7B%0A++++++++++++%09k%3Dtrue%3B%0A++++++++%09%7D%0A%09%7D%0A%7D%0A++%0A%09if%28%21k%29%7Balert%28%27%D0%9D%D0%B8%D1%87%D0%B5%D0%B3%D0%BE+%D0%BD%D0%B5+%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE%27%29%3B%7D%0A%09return+k%3B%0A%7D%0A%0A%0A%3C%2Fscript%3E%3C%2Fhead%3E%0A%3Cbody+onLoad%3D%22z%28%29%22%3E%0A'
   90     2        FETCH_IS                                         ~4      '_POST'
          3        ISSET_ISEMPTY_DIM_OBJ                         0          ~4, 'submitMe'
          4      > JMPZ                                                     ~5, ->22
   92     5    >   ECHO                                                     '%D0%92%D0%B0%D0%BC%D0%B8+%D0%B1%D1%8B%D0%BB%D0%B8+%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D1%8B+%D1%81%D0%BB%D0%B5%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B5+%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B8%3A%3Cbr%3E'
   93     6        FETCH_R                      global              ~6      '_POST'
          7      > FE_RESET_R                                       $7      ~6, ->20
          8    > > FE_FETCH_R                                       ~8      $7, !1, ->20
          9    >   ASSIGN                                                   !2, ~8
   95    10        IS_EQUAL                                                 !1, 'on'
         11      > JMPZ                                                     ~10, ->19
         12    >   FETCH_DIM_R                                      ~11     !0, !2
         13        CONCAT                                           ~12     '%3Ca+href%3D%22', ~11
         14        CONCAT                                           ~13     ~12, '%22%3E'
         15        FETCH_DIM_R                                      ~14     !0, !2
         16        CONCAT                                           ~15     ~13, ~14
         17        CONCAT                                           ~16     ~15, '%3C%2Fa%3E%3Cbr%3E'
         18        ECHO                                                     ~16
   93    19    > > JMP                                                      ->8
         20    >   FE_FREE                                                  $7
         21      > JMP                                                      ->37
  104    22    >   ECHO                                                     '%3Cform+name%3D%27MyList%27+method%3D%22POST%22+action%3D%22'
         23        FETCH_R                      global              ~17     '_SERVER'
         24        FETCH_DIM_R                                      ~18     ~17, 'PHP_SELF'
         25        ECHO                                                     ~18
         26        ECHO                                                     '%22+onsubmit%3D%22return+s%28%29%3B%22%3E%0A%3Ctable+border%3Dall%3E%3Ccol+align%3Dcenter%3E%3Ccol+align%3Dleft%3E%0A'
  106    27        INIT_FCALL                                               'mylisttohtml'
         28        INIT_FCALL                                               'mylist'
         29        INIT_FCALL                                               'mycount'
         30        DO_FCALL                                      0  $19     
         31        SEND_VAR                                                 $19
         32        DO_FCALL                                      0  $20     
         33        SEND_VAR                                                 $20
         34        DO_FCALL                                      0  $21     
         35        ECHO                                                     $21
  107    36        ECHO                                                     '%3Ctr%3E%3Cth%3E%26nbsp%3B%3Cth%3E%3Cinput+type%3Dsubmit+name%3D%22submitMe%22+value%3D%22O%D0%BA%22+style%3D%22width%3A200px%3B%22%3E%3C%2Ftr%3E%0A%3C%2Ftable%3E%0A%3C%2Fform%3E%0A'
  113    37    >   ECHO                                                     '%3C%2Fbody%3E%3C%2Fhtml%3E%0A%24end'
  114    38      > RETURN                                                   1

Function mycount:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 50
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/3UKqj
function name:  MyCount
number of ops:  54
compiled vars:  !0 = $links, !1 = $file, !2 = $fp, !3 = $k, !4 = $z, !5 = $countf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   BIND_GLOBAL                                              !0, 'links'
   11     1        ASSIGN                                                   !1, 'count.txt'
   12     2        INIT_FCALL                                               'file_exists'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $7      
          5        BOOL_NOT                                         ~8      $7
          6      > JMPZ                                                     ~8, ->19
          7    >   INIT_FCALL                                               'fopen'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 'w'
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
         12        INIT_FCALL                                               'fwrite'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 '0'
         15        DO_ICALL                                                 
         16        INIT_FCALL                                               'fclose'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   13    19    >   INIT_FCALL                                               'file_get_contents'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $13     
         22        CAST                                          4  ~14     $13
         23        ASSIGN                                                   !3, ~14
   14    24        ADD                                              ~16     !3, 1
         25        ASSIGN                                                   !4, ~16
   15    26        INIT_FCALL                                               'fopen'
         27        SEND_VAR                                                 !1
         28        SEND_VAL                                                 'r%2B'
         29        DO_ICALL                                         $18     
         30        ASSIGN                                                   !5, $18
   16    31        INIT_FCALL                                               'flock'
         32        SEND_VAR                                                 !5
         33        SEND_VAL                                                 2
         34        DO_ICALL                                                 
   17    35        INIT_FCALL                                               'fputs'
         36        SEND_VAR                                                 !5
         37        SEND_VAR                                                 !4
         38        DO_ICALL                                                 
   18    39        INIT_FCALL                                               'fclose'
         40        SEND_VAR                                                 !5
         41        DO_ICALL                                                 
   19    42        COUNT                                            ~23     !0
         43        MOD                                              ~24     !3, ~23
         44        ASSIGN                                                   !4, ~24
   20    45        IS_EQUAL                                                 !4, 0
         46      > JMPZ                                                     ~26, ->50
         47    >   COUNT                                            ~27     !0
         48        ASSIGN                                                   !4, ~27
         49      > JMP                                                      ->52
         50    >   SUB                                              ~29     !4, 1
         51        ASSIGN                                                   !4, ~29
   21    52    > > RETURN                                                   !4
   22    53*     > RETURN                                                   null

End of function mycount

Function mylist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
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: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3UKqj
function name:  MyList
number of ops:  32
compiled vars:  !0 = $k, !1 = $links, !2 = $z, !3 = $links2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        BIND_GLOBAL                                              !1, 'links'
   27     2        COUNT                                            ~4      !1
          3        SUB                                              ~5      ~4, !0
          4        ASSIGN                                                   !2, ~5
   28     5        IS_SMALLER                                               !2, 5
          6      > JMPZ                                                     ~7, ->23
   29     7    >   INIT_FCALL                                               'array_slice'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !2
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $8      
         13        INIT_FCALL                                               'array_slice'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 0
         16        SUB                                              ~9      5, !2
         17        SEND_VAL                                                 ~9
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $10     
         20        ADD                                              ~11     $8, $10
         21        ASSIGN                                                   !3, ~11
         22      > JMP                                                      ->30
   33    23    >   INIT_FCALL                                               'array_slice'
         24        SEND_VAR                                                 !1
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 5
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $13     
         29        ASSIGN                                                   !3, $13
   37    30    > > RETURN                                                   !3
   38    31*     > RETURN                                                   null

End of function mylist

Function mylisttohtml:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/3UKqj
function name:  MyListToHTML
number of ops:  20
compiled vars:  !0 = $list, !1 = $out, !2 = $value, !3 = $key, !4 = $key2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        ASSIGN                                                   !1, ''
   43     2      > FE_RESET_R                                       $6      !0, ->17
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->17
          4    >   ASSIGN                                                   !3, ~7
   44     5        ADD                                              ~9      !3, 1
          6        ASSIGN                                                   !4, ~9
   45     7        CONCAT                                           ~11     '%3Ctr%3E%3Cth%3E%3Cinput+id%3D%22', !4
          8        CONCAT                                           ~12     ~11, '%22+name%3D%22'
          9        CONCAT                                           ~13     ~12, !3
         10        CONCAT                                           ~14     ~13, '%22+type%3Dcheckbox%3E%3Cth%3E%3Clabel+for%3D%22'
         11        CONCAT                                           ~15     ~14, !4
         12        CONCAT                                           ~16     ~15, '%22%3E'
         13        CONCAT                                           ~17     ~16, !2
         14        CONCAT                                           ~18     ~17, '%3C%2Flabel%3E%3C%2Ftr%3E'
         15        ASSIGN_OP                                     8          !1, ~18
   43    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $6
   47    18      > RETURN                                                   !1
   48    19*     > RETURN                                                   null

End of function mylisttohtml

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.39 ms | 1406 KiB | 32 Q