3v4l.org

run code in 300+ PHP versions simultaneously
<?php $current_path = 'http://www.liveinstyle.com/star-speak/the-ranveer-singh-royal-challenge-can-it-get-bolder-than-this-5656'; $social_share = array("http://graph.facebook.com/?id=", "http://cdn.api.twitter.com/1/urls/count.json?url=","http://api.pinterest.com/v1/urls/count.json?callback=jsonp&url=", "https://plusone.google.com/_/+1/fastbutton?url="); $share = 0; foreach($social_share as $social) { $url = $social. $current_path; $json_output = file_get_contents($url, TRUE); $json = json_decode($json_output, TRUE); if($social == "http://graph.facebook.com/?id="){ $share += $json['shares']; } elseif($social == "https://plusone.google.com/_/+1/fastbutton?url="){ $doc = new DOMDocument(); @$doc->loadHTML($json_output); $counter=$doc->getElementById('aggregateCount'); $share += $counter->nodue; } else{ $share += $json['count']; } } print $share;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 42
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 42
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/H66Dl
function name:  (null)
number of ops:  45
compiled vars:  !0 = $current_path, !1 = $social_share, !2 = $share, !3 = $social, !4 = $url, !5 = $json_output, !6 = $json, !7 = $doc, !8 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.liveinstyle.com%2Fstar-speak%2Fthe-ranveer-singh-royal-challenge-can-it-get-bolder-than-this-5656'
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 0
    6     3      > FE_RESET_R                                       $12     !1, ->42
          4    > > FE_FETCH_R                                               $12, !3, ->42
    7     5    >   CONCAT                                           ~13     !3, !0
          6        ASSIGN                                                   !4, ~13
    8     7        INIT_FCALL                                               'file_get_contents'
          8        SEND_VAR                                                 !4
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $15     
         11        ASSIGN                                                   !5, $15
    9    12        INIT_FCALL                                               'json_decode'
         13        SEND_VAR                                                 !5
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $17     
         16        ASSIGN                                                   !6, $17
   10    17        IS_EQUAL                                                 !3, 'http%3A%2F%2Fgraph.facebook.com%2F%3Fid%3D'
         18      > JMPZ                                                     ~19, ->22
   11    19    >   FETCH_DIM_R                                      ~20     !6, 'shares'
         20        ASSIGN_OP                                     1          !2, ~20
         21      > JMP                                                      ->41
   13    22    >   IS_EQUAL                                                 !3, 'https%3A%2F%2Fplusone.google.com%2F_%2F%2B1%2Ffastbutton%3Furl%3D'
         23      > JMPZ                                                     ~22, ->39
   14    24    >   NEW                                              $23     'DOMDocument'
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !7, $23
         27        BEGIN_SILENCE                                    ~26     
         28        INIT_METHOD_CALL                                         !7, 'loadHTML'
         29        SEND_VAR_EX                                              !5
         30        DO_FCALL                                      0          
         31        END_SILENCE                                              ~26
   15    32        INIT_METHOD_CALL                                         !7, 'getElementById'
         33        SEND_VAL_EX                                              'aggregateCount'
         34        DO_FCALL                                      0  $28     
         35        ASSIGN                                                   !8, $28
   16    36        FETCH_OBJ_R                                      ~30     !8, 'nodue'
         37        ASSIGN_OP                                     1          !2, ~30
         38      > JMP                                                      ->41
   20    39    >   FETCH_DIM_R                                      ~32     !6, 'count'
         40        ASSIGN_OP                                     1          !2, ~32
    6    41    > > JMP                                                      ->4
         42    >   FE_FREE                                                  $12
   24    43        ECHO                                                     !2
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.38 ms | 1400 KiB | 17 Q