3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* GET リクエストでのシンプルなAPI */ //URLを指定 $url = "http://www.php.net/"; $res = file_get_contents("http://api.b.st-hatena.com/entry.count?url=".$url); var_dump($res); ?> <?php /* 被ブックマーク合計数取得API */ $request = xmlrpc_encode_request("bookmark.getTotalCount", $url); $context = stream_context_create(array('http' => array( 'method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request ))); $file = file_get_contents("http://b.hatena.ne.jp/xmlrpc", false, $context); $response = xmlrpc_decode($file); var_dump($response); ?> <?php /* 50件以降も取得する 規制回避 */ function get_HB_favorited_counts(array $urls) { $ret = array_fill_keys($urls, false); $base_url = 'http://api.b.st-hatena.com/entry.counts'; foreach (array_chunk($urls, 50) as $set) { $query = '?' .implode('&', array_map(function ($url) { return 'url=' . rawurlencode($url); }, $set)); $res = json_decode(@file_get_contents($base_url . $query), true); if (is_array($res)) { foreach ($res as $url => $count) { $ret[$url] = $count; } } } return $ret; } $urls = array('http://codecanyon.net/', 'http://www.htaccesseditor.com/', 'http://phplab.jp/', 'http://www.php.net/', 'http://nicovideo.jp/', 'http://google.com/', 'http://google.co.jp/', 'http://example.com/', 'http://www.php.gr.jp/', 'http://php-users.jp/', 'http://aws.amazon.com/jp/php/', 'http://www.ioncube.jp/', 'http://amazon.com/', 'http://amazon.co.jp/', 'http://ameblo.jp/', 'http://blog.livedoor.com/', 'http://jugem.jp/', 'http://blog.fc2.com/', 'http://blog.seesaa.jp/contents/about/?via=a8', 'http://d.hatena.ne.jp/', 'http://blog.so-net.ne.jp/', 'http://www.ninja.co.jp/blog/', 'http://plaza.rakuten.co.jp/', 'http://blog.goo.ne.jp/', 'http://www.fruitblog.net/', 'http://www.exblog.jp/', 'http://blog.oricon.co.jp/', 'http://blogs.yahoo.co.jp/', 'http://ja.wordpress.com/', 'http://webryblog.biglobe.ne.jp/', 'http://www.yaplog.jp/', 'http://www.anisen.tv/', 'http://gamecs.jp/', 'http://www.eniblo.com/', 'http://blog.kuruten.jp/', 'http://iralog.net/', 'http://h.hatena.ne.jp/', 'http://www.foodlog.jp/', 'http://www.b-shoku.jp/', 'http://d-nikki.com/', 'http://a-thera.com/', 'http://blog.emachi.co.jp/blog/', 'http://www.areablog.jp/', 'http://www.2chiiki.jp/', 'http://www.zige.jp/', 'http://blog.qlep.com/', 'http://blog.goyah.net/', 'http://blog.saitamania.net/', 'http://fblg.jp/', 'https://arekao.jp/index.php?module=Profile&action=ShowRegistForm', 'http://sl.lcomi.ne.jp/mrs/', 'http://blog.k-plaza.com/', 'http://www.actiblog.com/' ); foreach (get_HB_favorited_counts($urls) as $key=>$c){ echo $key.'==>'.$c.'<br/>'; } echo 'Array count==>'.count($urls); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 49
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/V93vd
function name:  (null)
number of ops:  54
compiled vars:  !0 = $url, !1 = $res, !2 = $request, !3 = $context, !4 = $file, !5 = $response, !6 = $urls, !7 = $c, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.php.net%2F'
    7     1        INIT_FCALL                                               'file_get_contents'
          2        CONCAT                                           ~10     'http%3A%2F%2Fapi.b.st-hatena.com%2Fentry.count%3Furl%3D', !0
          3        SEND_VAL                                                 ~10
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !1, $11
    9     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   13     9        ECHO                                                     '%0A'
   16    10        INIT_FCALL_BY_NAME                                       'xmlrpc_encode_request'
         11        SEND_VAL_EX                                              'bookmark.getTotalCount'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !2, $14
   17    15        INIT_FCALL                                               'stream_context_create'
   18    16        INIT_ARRAY                                       ~16     'POST', 'method'
   19    17        ADD_ARRAY_ELEMENT                                ~16     'Content-Type%3A+text%2Fxml', 'header'
   20    18        ADD_ARRAY_ELEMENT                                ~16     !2, 'content'
         19        INIT_ARRAY                                       ~17     ~16, 'http'
         20        SEND_VAL                                                 ~17
         21        DO_ICALL                                         $18     
   17    22        ASSIGN                                                   !3, $18
   23    23        INIT_FCALL                                               'file_get_contents'
         24        SEND_VAL                                                 'http%3A%2F%2Fb.hatena.ne.jp%2Fxmlrpc'
         25        SEND_VAL                                                 <false>
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !4, $20
   24    29        INIT_FCALL_BY_NAME                                       'xmlrpc_decode'
         30        SEND_VAR_EX                                              !4
         31        DO_FCALL                                      0  $22     
         32        ASSIGN                                                   !5, $22
   25    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !5
         35        DO_ICALL                                                 
   28    36        ECHO                                                     '%0A%0A'
   49    37        ASSIGN                                                   !6, <array>
  104    38        INIT_FCALL                                               'get_hb_favorited_counts'
         39        SEND_VAR                                                 !6
         40        DO_FCALL                                      0  $26     
         41      > FE_RESET_R                                       $27     $26, ->49
         42    > > FE_FETCH_R                                       ~28     $27, !7, ->49
         43    >   ASSIGN                                                   !8, ~28
  105    44        CONCAT                                           ~30     !8, '%3D%3D%3E'
         45        CONCAT                                           ~31     ~30, !7
         46        CONCAT                                           ~32     ~31, '%3Cbr%2F%3E'
         47        ECHO                                                     ~32
  104    48      > JMP                                                      ->42
         49    >   FE_FREE                                                  $27
  108    50        COUNT                                            ~33     !6
         51        CONCAT                                           ~34     'Array+count%3D%3D%3E', ~33
         52        ECHO                                                     ~34
  110    53      > RETURN                                                   1

Function get_hb_favorited_counts:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 45
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 45
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 44
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 43
Branch analysis from position: 44
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/V93vd
function name:  get_HB_favorited_counts
number of ops:  48
compiled vars:  !0 = $urls, !1 = $ret, !2 = $base_url, !3 = $set, !4 = $query, !5 = $res, !6 = $count, !7 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   33     1        INIT_FCALL                                               'array_fill_keys'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <false>
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
   34     6        ASSIGN                                                   !2, 'http%3A%2F%2Fapi.b.st-hatena.com%2Fentry.counts'
   35     7        INIT_FCALL                                               'array_chunk'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 50
         10        DO_ICALL                                         $11     
         11      > FE_RESET_R                                       $12     $11, ->45
         12    > > FE_FETCH_R                                               $12, !3, ->45
   36    13    >   INIT_FCALL                                               'implode'
         14        SEND_VAL                                                 '%26'
         15        INIT_FCALL                                               'array_map'
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FV93vd%3A36%240'
   38    17        SEND_VAL                                                 ~13
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                         $15     
         22        CONCAT                                           ~16     '%3F', $15
   36    23        ASSIGN                                                   !4, ~16
   39    24        INIT_FCALL                                               'json_decode'
         25        BEGIN_SILENCE                                    ~18     
         26        INIT_FCALL                                               'file_get_contents'
         27        CONCAT                                           ~19     !2, !4
         28        SEND_VAL                                                 ~19
         29        DO_ICALL                                         $20     
         30        END_SILENCE                                              ~18
         31        SEND_VAR                                                 $20
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $21     
         34        ASSIGN                                                   !5, $21
   40    35        TYPE_CHECK                                  128          !5
         36      > JMPZ                                                     ~23, ->44
   41    37    > > FE_RESET_R                                       $24     !5, ->43
         38    > > FE_FETCH_R                                       ~25     $24, !6, ->43
         39    >   ASSIGN                                                   !7, ~25
   42    40        ASSIGN_DIM                                               !1, !7
         41        OP_DATA                                                  !6
   41    42      > JMP                                                      ->38
         43    >   FE_FREE                                                  $24
   35    44    > > JMP                                                      ->12
         45    >   FE_FREE                                                  $12
   46    46      > RETURN                                                   !1
   47    47*     > RETURN                                                   null

End of function get_hb_favorited_counts

Function %00%7Bclosure%7D%2Fin%2FV93vd%3A36%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V93vd
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        INIT_FCALL                                               'rawurlencode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        CONCAT                                           ~2      'url%3D', $1
          5      > RETURN                                                   ~2
   38     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FV93vd%3A36%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.11 ms | 1407 KiB | 32 Q