3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* Plugin Name: Weather Plugin Plugin URI: http://www.yourpluginurlhere.com/ Version: Current Version Author: Name please Description: What does your plugin do and what features does it offer... */ /** * Weather Plugin For Wordpress */ /** * Proper way to enqueue scripts and styles */ define('APFSURL', WP_PLUGIN_URL . "/" . dirname(plugin_basename(__FILE__))); function theme_name_scripts() { //define('weather-plugin', WP_PLUGIN_URL . "/" . dirname(plugin_basename(__FILE__))); wp_enqueue_style( 'weather-plugin', get_stylesheet_uri() ); wp_enqueue_script( 'weather-plugin',APFSURL.'/js/weather-plugin.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'theme_name_scripts' ); add_shortcode('weather-plugin','weather_function'); function weather_function(){ $ip = '203.135.41.33';//$_SERVER['REMOTE_ADDR']; $xml = new SimpleXMLElement(file_get_contents("http://www.geoplugin.net/xml.gp?={$ip}")); $city = (array)$xml->geoplugin_city; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22%27'.$city[0].'%27%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $weather_rss = curl_exec($ch); echo curl_error($ch); curl_close($ch); $return = json_decode($weather_rss); var_dump($weather_rss); $temp = $return->query->results->channel->item->condition->temp; echo "<div> Weather &nbsp; : &nbsp;"; echo "<div class = 'farenheit'> ".$temp." </div>"; $centi = 5/9*($temp-32); $centi1 = number_format((float)$centi, 0, '.', ''); echo "<div class = 'centigrade' style='display:none'> ".$centi1." </div>"; echo "<a hredf='#' id='btn1'>&nbsp;F</a> / <a href='#' id='btn2'> C</a>"; echo "</div>"; } ?>
based on CGouK
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0NcJL
function name:  (null)
number of ops:  24
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   INIT_FCALL                                               'define'
         1        SEND_VAL                                                 'APFSURL'
         2        FETCH_CONSTANT                                   ~0      'WP_PLUGIN_URL'
         3        CONCAT                                           ~1      ~0, '%2F'
         4        INIT_FCALL                                               'dirname'
         5        INIT_FCALL_BY_NAME                                       'plugin_basename'
         6        SEND_VAL_EX                                              '%2Fin%2F0NcJL'
         7        DO_FCALL                                      0  $2      
         8        SEND_VAR                                                 $2
         9        DO_ICALL                                         $3      
        10        CONCAT                                           ~4      ~1, $3
        11        SEND_VAL                                                 ~4
        12        DO_ICALL                                                 
  17    13        NOP                                                      
  23    14        INIT_FCALL_BY_NAME                                       'add_action'
        15        SEND_VAL_EX                                              'wp_enqueue_scripts'
        16        SEND_VAL_EX                                              'theme_name_scripts'
        17        DO_FCALL                                      0          
  25    18        INIT_FCALL_BY_NAME                                       'add_shortcode'
        19        SEND_VAL_EX                                              'weather-plugin'
        20        SEND_VAL_EX                                              'weather_function'
        21        DO_FCALL                                      0          
  26    22        NOP                                                      
  54    23      > RETURN                                                   1

Function theme_name_scripts:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0NcJL
function name:  theme_name_scripts
number of ops:  16
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  19     0  E >   INIT_FCALL_BY_NAME                                       'wp_enqueue_style'
         1        SEND_VAL_EX                                              'weather-plugin'
         2        INIT_FCALL_BY_NAME                                       'get_stylesheet_uri'
         3        DO_FCALL                                      0  $0      
         4        SEND_VAR_NO_REF_EX                                       $0
         5        DO_FCALL                                      0          
  20     6        INIT_FCALL_BY_NAME                                       'wp_enqueue_script'
         7        SEND_VAL_EX                                              'weather-plugin'
         8        FETCH_CONSTANT                                   ~2      'APFSURL'
         9        CONCAT                                           ~3      ~2, '%2Fjs%2Fweather-plugin.js'
        10        SEND_VAL_EX                                              ~3
        11        SEND_VAL_EX                                              <array>
        12        SEND_VAL_EX                                              '1.0.0'
        13        SEND_VAL_EX                                              <true>
        14        DO_FCALL                                      0          
  21    15      > RETURN                                                   null

End of function theme_name_scripts

Function weather_function:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0NcJL
function name:  weather_function
number of ops:  89
compiled vars:  !0 = $ip, !1 = $xml, !2 = $city, !3 = $ch, !4 = $weather_rss, !5 = $return, !6 = $temp, !7 = $centi, !8 = $centi1
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  27     0  E >   ASSIGN                                                   !0, '203.135.41.33'
  28     1        NEW                                              $10     :-4
         2        INIT_FCALL                                               'file_get_contents'
         3        NOP                                                      
         4        FAST_CONCAT                                      ~11     'http%3A%2F%2Fwww.geoplugin.net%2Fxml.gp%3F%3D', !0
         5        SEND_VAL                                                 ~11
         6        DO_ICALL                                         $12     
         7        SEND_VAR_NO_REF_EX                                       $12
         8        DO_FCALL                                      0          
         9        ASSIGN                                                   !1, $10
  29    10        FETCH_OBJ_R                                      $15     !1, 'geoplugin_city'
        11        CAST                                          7  ~16     $15
        12        ASSIGN                                                   !2, ~16
  30    13        INIT_FCALL_BY_NAME                                       'curl_init'
        14        DO_FCALL                                      0  $18     
        15        ASSIGN                                                   !3, $18
  31    16        INIT_FCALL_BY_NAME                                       'curl_setopt'
        17        SEND_VAR_EX                                              !3
        18        FETCH_CONSTANT                                   ~20     'CURLOPT_URL'
        19        SEND_VAL_EX                                              ~20
        20        FETCH_DIM_R                                      $21     !2, 0
        21        CONCAT                                           ~22     'http%3A%2F%2Fquery.yahooapis.com%2Fv1%2Fpublic%2Fyql%3Fq%3Dselect%2520%2A%2520from%2520weather.forecast%2520where%2520woeid%2520in%2520%28select%2520woeid%2520from%2520geo.places%281%29%2520where%2520text%253D%2522%2527', $21
        22        CONCAT                                           ~23     ~22, '%2527%252C%2520ak%2522%29%26format%3Djson%26env%3Dstore%253A%252F%252Fdatatables.org%252Falltableswithkeys'
        23        SEND_VAL_EX                                              ~23
        24        DO_FCALL                                      0          
  32    25        INIT_FCALL_BY_NAME                                       'curl_setopt'
        26        SEND_VAR_EX                                              !3
        27        FETCH_CONSTANT                                   ~25     'CURLOPT_RETURNTRANSFER'
        28        SEND_VAL_EX                                              ~25
        29        SEND_VAL_EX                                              1
        30        DO_FCALL                                      0          
  33    31        INIT_FCALL_BY_NAME                                       'curl_setopt'
        32        SEND_VAR_EX                                              !3
        33        FETCH_CONSTANT                                   ~27     'CURLOPT_SSL_VERIFYHOST'
        34        SEND_VAL_EX                                              ~27
        35        SEND_VAL_EX                                              <false>
        36        DO_FCALL                                      0          
  34    37        INIT_FCALL_BY_NAME                                       'curl_setopt'
        38        SEND_VAR_EX                                              !3
        39        FETCH_CONSTANT                                   ~29     'CURLOPT_SSL_VERIFYPEER'
        40        SEND_VAL_EX                                              ~29
        41        SEND_VAL_EX                                              <false>
        42        DO_FCALL                                      0          
  35    43        INIT_FCALL_BY_NAME                                       'curl_exec'
        44        SEND_VAR_EX                                              !3
        45        DO_FCALL                                      0  $31     
        46        ASSIGN                                                   !4, $31
  36    47        INIT_FCALL_BY_NAME                                       'curl_error'
        48        SEND_VAR_EX                                              !3
        49        DO_FCALL                                      0  $33     
        50        ECHO                                                     $33
  37    51        INIT_FCALL_BY_NAME                                       'curl_close'
        52        SEND_VAR_EX                                              !3
        53        DO_FCALL                                      0          
  39    54        INIT_FCALL                                               'json_decode'
        55        SEND_VAR                                                 !4
        56        DO_ICALL                                         $35     
        57        ASSIGN                                                   !5, $35
  40    58        INIT_FCALL                                               'var_dump'
        59        SEND_VAR                                                 !4
        60        DO_ICALL                                                 
  41    61        FETCH_OBJ_R                                      $38     !5, 'query'
        62        FETCH_OBJ_R                                      $39     $38, 'results'
        63        FETCH_OBJ_R                                      $40     $39, 'channel'
        64        FETCH_OBJ_R                                      $41     $40, 'item'
        65        FETCH_OBJ_R                                      $42     $41, 'condition'
        66        FETCH_OBJ_R                                      $43     $42, 'temp'
        67        ASSIGN                                                   !6, $43
  42    68        ECHO                                                     '%3Cdiv%3E%0A%09Weather+%26nbsp%3B+%3A+%26nbsp%3B'
  44    69        CONCAT                                           ~45     '%3Cdiv+class+%3D+%27farenheit%27%3E+', !6
        70        CONCAT                                           ~46     ~45, '+%3C%2Fdiv%3E'
        71        ECHO                                                     ~46
  45    72        SUB                                              ~47     !6, 32
        73        MUL                                              ~48     0.555556, ~47
        74        ASSIGN                                                   !7, ~48
  46    75        INIT_FCALL                                               'number_format'
        76        CAST                                          5  ~50     !7
        77        SEND_VAL                                                 ~50
        78        SEND_VAL                                                 0
        79        SEND_VAL                                                 '.'
        80        SEND_VAL                                                 ''
        81        DO_ICALL                                         $51     
        82        ASSIGN                                                   !8, $51
  47    83        CONCAT                                           ~53     '%3Cdiv+class+%3D+%27centigrade%27+style%3D%27display%3Anone%27%3E+', !8
        84        CONCAT                                           ~54     ~53, '+%3C%2Fdiv%3E'
        85        ECHO                                                     ~54
  48    86        ECHO                                                     '%3Ca+hredf%3D%27%23%27+id%3D%27btn1%27%3E%26nbsp%3BF%3C%2Fa%3E%0A%09%2F%0A%09%3Ca+href%3D%27%23%27+id%3D%27btn2%27%3E+C%3C%2Fa%3E'
  51    87        ECHO                                                     '%3C%2Fdiv%3E'
  53    88      > RETURN                                                   null

End of function weather_function

Generated using Vulcan Logic Dumper, using php 7.3.0