3v4l.org

run code in 300+ PHP versions simultaneously
<?php class World { public $name; public $numOnline; public $location; public $type; public $adtInfo; public $onlineRecord; public $creationDate; public $worldQuestTitles; function __construct() { } } $c = curl_init('http://www.tibia.com/community/?subtopic=worlds'); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $html = curl_exec($c); if (curl_error($c)) die(curl_error($c)); curl_close($c); $html = strip_tags($html, "<tr><td><table>"); //Get the html code without remove the specific tags $start = strpos($html, "Additional Information"); //Start for substring $html = substr($html, $start); //Remove the first useless characters $end = strpos($html, "</table>"); //Get the end of the substring $html = substr($html, 22, ($end - 22)); //Last substring - Note: 22 = "Additional Information" Length $arr; preg_match_all("/<td>([^<]*)<\/td>/", $html, $arr); //Regex to the the groups //Array to build all worlds objects $worlds = array(); $index = 0; for($i = 0; $i < count($arr[0]); $i+=5) { $w = new World(); $w->name = $arr[0][$i]; $w->numOnline = $arr[0][$i + 1]; $w->location = $arr[0][$i + 2]; $w->type = $arr[0][$i + 3]; $w->adtInfo = $arr[0][$i + 4]; array_push($worlds, $w); } var_dump($worlds); die(); foreach($worlds as $w){ if(is_object($w)){ //echo $w->name."<br />"; $string = "http://www.tibia.com/community/?subtopic=worlds&world=".$w->name; $ch = curl_init($string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HEADER, true); $html2 = curl_exec($ch); if (curl_error($ch)) die(curl_error($ch)); curl_close($ch); $html2 = strip_tags($html2, "<tr><td><table>"); $start = strpos($html2, "World Information"); $html2 = substr($html2, $start); echo $string."<br />". $html; return; $end = strpos($html2, "</table>"); $html2 = substr($html2, 17, ($end - 17)); echo $start." ".$end; break; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 93
Branch analysis from position: 93
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 61
Branch analysis from position: 97
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 97, Position 2 = 61
Branch analysis from position: 97
Branch analysis from position: 61
filename:       /in/L3r3L
function name:  (null)
number of ops:  184
compiled vars:  !0 = $c, !1 = $html, !2 = $start, !3 = $end, !4 = $arr, !5 = $worlds, !6 = $index, !7 = $i, !8 = $w, !9 = $string, !10 = $ch, !11 = $html2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL_BY_NAME                                       'curl_init'
          1        SEND_VAL_EX                                              'http%3A%2F%2Fwww.tibia.com%2Fcommunity%2F%3Fsubtopic%3Dworlds'
          2        DO_FCALL                                      0  $12     
          3        ASSIGN                                                   !0, $12
   18     4        INIT_FCALL_BY_NAME                                       'curl_setopt'
          5        SEND_VAR_EX                                              !0
          6        FETCH_CONSTANT                                   ~14     'CURLOPT_RETURNTRANSFER'
          7        SEND_VAL_EX                                              ~14
          8        SEND_VAL_EX                                              <true>
          9        DO_FCALL                                      0          
   20    10        INIT_FCALL_BY_NAME                                       'curl_exec'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $16     
         13        ASSIGN                                                   !1, $16
   21    14        INIT_FCALL_BY_NAME                                       'curl_error'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $18     
         17      > JMPZ                                                     $18, ->22
   22    18    >   INIT_FCALL_BY_NAME                                       'curl_error'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0  $19     
         21      > EXIT                                                     $19
   24    22    >   INIT_FCALL_BY_NAME                                       'curl_close'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0          
   26    25        INIT_FCALL                                               'strip_tags'
         26        SEND_VAR                                                 !1
         27        SEND_VAL                                                 '%3Ctr%3E%3Ctd%3E%3Ctable%3E'
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !1, $21
   27    30        INIT_FCALL                                               'strpos'
         31        SEND_VAR                                                 !1
         32        SEND_VAL                                                 'Additional+Information'
         33        DO_ICALL                                         $23     
         34        ASSIGN                                                   !2, $23
   28    35        INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !1
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $25     
         39        ASSIGN                                                   !1, $25
   29    40        INIT_FCALL                                               'strpos'
         41        SEND_VAR                                                 !1
         42        SEND_VAL                                                 '%3C%2Ftable%3E'
         43        DO_ICALL                                         $27     
         44        ASSIGN                                                   !3, $27
   30    45        INIT_FCALL                                               'substr'
         46        SEND_VAR                                                 !1
         47        SEND_VAL                                                 22
         48        SUB                                              ~29     !3, 22
         49        SEND_VAL                                                 ~29
         50        DO_ICALL                                         $30     
         51        ASSIGN                                                   !1, $30
   33    52        INIT_FCALL                                               'preg_match_all'
         53        SEND_VAL                                                 '%2F%3Ctd%3E%28%5B%5E%3C%5D%2A%29%3C%5C%2Ftd%3E%2F'
         54        SEND_VAR                                                 !1
         55        SEND_REF                                                 !4
         56        DO_ICALL                                                 
   36    57        ASSIGN                                                   !5, <array>
   37    58        ASSIGN                                                   !6, 0
   39    59        ASSIGN                                                   !7, 0
         60      > JMP                                                      ->93
   41    61    >   NEW                                              $36     'World'
         62        DO_FCALL                                      0          
         63        ASSIGN                                                   !8, $36
   42    64        FETCH_DIM_R                                      ~40     !4, 0
         65        FETCH_DIM_R                                      ~41     ~40, !7
         66        ASSIGN_OBJ                                               !8, 'name'
         67        OP_DATA                                                  ~41
   43    68        ADD                                              ~44     !7, 1
         69        FETCH_DIM_R                                      ~43     !4, 0
         70        FETCH_DIM_R                                      ~45     ~43, ~44
         71        ASSIGN_OBJ                                               !8, 'numOnline'
         72        OP_DATA                                                  ~45
   44    73        ADD                                              ~48     !7, 2
         74        FETCH_DIM_R                                      ~47     !4, 0
         75        FETCH_DIM_R                                      ~49     ~47, ~48
         76        ASSIGN_OBJ                                               !8, 'location'
         77        OP_DATA                                                  ~49
   45    78        ADD                                              ~52     !7, 3
         79        FETCH_DIM_R                                      ~51     !4, 0
         80        FETCH_DIM_R                                      ~53     ~51, ~52
         81        ASSIGN_OBJ                                               !8, 'type'
         82        OP_DATA                                                  ~53
   46    83        ADD                                              ~56     !7, 4
         84        FETCH_DIM_R                                      ~55     !4, 0
         85        FETCH_DIM_R                                      ~57     ~55, ~56
         86        ASSIGN_OBJ                                               !8, 'adtInfo'
         87        OP_DATA                                                  ~57
   48    88        INIT_FCALL                                               'array_push'
         89        SEND_REF                                                 !5
         90        SEND_VAR                                                 !8
         91        DO_ICALL                                                 
   39    92        ASSIGN_OP                                     1          !7, 5
         93    >   FETCH_DIM_R                                      ~60     !4, 0
         94        COUNT                                            ~61     ~60
         95        IS_SMALLER                                               !7, ~61
         96      > JMPNZ                                                    ~62, ->61
   51    97    >   INIT_FCALL                                               'var_dump'
         98        SEND_VAR                                                 !5
         99        DO_ICALL                                                 
   52   100      > EXIT                                                     
   54   101*       FE_RESET_R                                       $64     !5, ->182
        102*       FE_FETCH_R                                               $64, !8, ->182
   55   103*       TYPE_CHECK                                  256          !8
        104*       JMPZ                                                     ~65, ->181
   58   105*       FETCH_OBJ_R                                      ~66     !8, 'name'
        106*       CONCAT                                           ~67     'http%3A%2F%2Fwww.tibia.com%2Fcommunity%2F%3Fsubtopic%3Dworlds%26world%3D', ~66
        107*       ASSIGN                                                   !9, ~67
   59   108*       INIT_FCALL_BY_NAME                                       'curl_init'
        109*       SEND_VAR_EX                                              !9
        110*       DO_FCALL                                      0  $69     
        111*       ASSIGN                                                   !10, $69
   60   112*       INIT_FCALL_BY_NAME                                       'curl_setopt'
        113*       SEND_VAR_EX                                              !10
        114*       FETCH_CONSTANT                                   ~71     'CURLOPT_RETURNTRANSFER'
        115*       SEND_VAL_EX                                              ~71
        116*       SEND_VAL_EX                                              <true>
        117*       DO_FCALL                                      0          
   61   118*       INIT_FCALL_BY_NAME                                       'curl_setopt'
        119*       SEND_VAR_EX                                              !10
        120*       FETCH_CONSTANT                                   ~73     'CURLOPT_POST'
        121*       SEND_VAL_EX                                              ~73
        122*       SEND_VAL_EX                                              <true>
        123*       DO_FCALL                                      0          
   62   124*       INIT_FCALL_BY_NAME                                       'curl_setopt'
        125*       SEND_VAR_EX                                              !10
        126*       FETCH_CONSTANT                                   ~75     'CURLOPT_HEADER'
        127*       SEND_VAL_EX                                              ~75
        128*       SEND_VAL_EX                                              <true>
        129*       DO_FCALL                                      0          
   64   130*       INIT_FCALL_BY_NAME                                       'curl_exec'
        131*       SEND_VAR_EX                                              !10
        132*       DO_FCALL                                      0  $77     
        133*       ASSIGN                                                   !11, $77
   65   134*       INIT_FCALL_BY_NAME                                       'curl_error'
        135*       SEND_VAR_EX                                              !10
        136*       DO_FCALL                                      0  $79     
        137*       JMPZ                                                     $79, ->142
   66   138*       INIT_FCALL_BY_NAME                                       'curl_error'
        139*       SEND_VAR_EX                                              !10
        140*       DO_FCALL                                      0  $80     
        141*       EXIT                                                     $80
   68   142*       INIT_FCALL_BY_NAME                                       'curl_close'
        143*       SEND_VAR_EX                                              !10
        144*       DO_FCALL                                      0          
   70   145*       INIT_FCALL                                               'strip_tags'
        146*       SEND_VAR                                                 !11
        147*       SEND_VAL                                                 '%3Ctr%3E%3Ctd%3E%3Ctable%3E'
        148*       DO_ICALL                                         $82     
        149*       ASSIGN                                                   !11, $82
   71   150*       INIT_FCALL                                               'strpos'
        151*       SEND_VAR                                                 !11
        152*       SEND_VAL                                                 'World+Information'
        153*       DO_ICALL                                         $84     
        154*       ASSIGN                                                   !2, $84
   72   155*       INIT_FCALL                                               'substr'
        156*       SEND_VAR                                                 !11
        157*       SEND_VAR                                                 !2
        158*       DO_ICALL                                         $86     
        159*       ASSIGN                                                   !11, $86
   74   160*       CONCAT                                           ~88     !9, '%3Cbr+%2F%3E'
        161*       CONCAT                                           ~89     ~88, !1
        162*       ECHO                                                     ~89
   75   163*       FE_FREE                                                  $64
        164*       RETURN                                                   null
   77   165*       INIT_FCALL                                               'strpos'
        166*       SEND_VAR                                                 !11
        167*       SEND_VAL                                                 '%3C%2Ftable%3E'
        168*       DO_ICALL                                         $90     
        169*       ASSIGN                                                   !3, $90
   78   170*       INIT_FCALL                                               'substr'
        171*       SEND_VAR                                                 !11
        172*       SEND_VAL                                                 17
        173*       SUB                                              ~92     !3, 17
        174*       SEND_VAL                                                 ~92
        175*       DO_ICALL                                         $93     
        176*       ASSIGN                                                   !11, $93
   80   177*       CONCAT                                           ~95     !2, '+'
        178*       CONCAT                                           ~96     ~95, !3
        179*       ECHO                                                     ~96
   81   180*       JMP                                                      ->182
   54   181*       JMP                                                      ->102
        182*       FE_FREE                                                  $64
   83   183*     > RETURN                                                   1

Class World:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3r3L
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function __construct

End of class World.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.79 ms | 1412 KiB | 25 Q