3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_title($url){ $str = file_get_contents($url); if(strlen($str)>0) { preg_match("/<title\>(.*)\<\/title\>/i", $str, $title); $title = "Title: " . $title[1] . "<br>"; return $title; } } function get_meta($url) { $meta = get_meta_tags($url); $description = "Description: " . $meta['description'] . "<br>"; $keywords = "Keywords: " . $meta['keywords'] . "<br>"; return [$description, $keywords]; } function get_header($url){ $str = file_get_contents($url); if(strlen($str)>0) { preg_match("/<h1.{31}>(.*)\<\/h1\>/i", $str, $header); $header = "H1: " . $header[1] . "<br>"; return $header; } } $meta = get_meta("https://hotels24.ua/"); echo get_title("https://hotels24.ua/"); echo $meta[0]; echo $meta[1]; echo get_header("https://hotels24.ua/");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1o52p
function name:  (null)
number of ops:  17
compiled vars:  !0 = $meta
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'get_meta'
          1        SEND_VAL                                                 'https%3A%2F%2Fhotels24.ua%2F'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   31     4        INIT_FCALL                                               'get_title'
          5        SEND_VAL                                                 'https%3A%2F%2Fhotels24.ua%2F'
          6        DO_FCALL                                      0  $3      
          7        ECHO                                                     $3
   32     8        FETCH_DIM_R                                      ~4      !0, 0
          9        ECHO                                                     ~4
   33    10        FETCH_DIM_R                                      ~5      !0, 1
         11        ECHO                                                     ~5
   34    12        INIT_FCALL                                               'get_header'
         13        SEND_VAL                                                 'https%3A%2F%2Fhotels24.ua%2F'
         14        DO_FCALL                                      0  $6      
         15        ECHO                                                     $6
         16      > RETURN                                                   1

Function get_title:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1o52p
function name:  get_title
number of ops:  19
compiled vars:  !0 = $url, !1 = $str, !2 = $title
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'file_get_contents'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    5     5        STRLEN                                           ~5      !1
          6        IS_SMALLER                                               0, ~5
          7      > JMPZ                                                     ~6, ->18
    6     8    >   INIT_FCALL                                               'preg_match'
          9        SEND_VAL                                                 '%2F%3Ctitle%5C%3E%28.%2A%29%5C%3C%5C%2Ftitle%5C%3E%2Fi'
         10        SEND_VAR                                                 !1
         11        SEND_REF                                                 !2
         12        DO_ICALL                                                 
    7    13        FETCH_DIM_R                                      ~8      !2, 1
         14        CONCAT                                           ~9      'Title%3A+', ~8
         15        CONCAT                                           ~10     ~9, '%3Cbr%3E'
         16        ASSIGN                                                   !2, ~10
    8    17      > RETURN                                                   !2
   10    18    > > RETURN                                                   null

End of function get_title

Function get_meta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1o52p
function name:  get_meta
number of ops:  17
compiled vars:  !0 = $url, !1 = $meta, !2 = $description, !3 = $keywords
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'get_meta_tags'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   14     5        FETCH_DIM_R                                      ~6      !1, 'description'
          6        CONCAT                                           ~7      'Description%3A+', ~6
          7        CONCAT                                           ~8      ~7, '%3Cbr%3E'
          8        ASSIGN                                                   !2, ~8
   15     9        FETCH_DIM_R                                      ~10     !1, 'keywords'
         10        CONCAT                                           ~11     'Keywords%3A+', ~10
         11        CONCAT                                           ~12     ~11, '%3Cbr%3E'
         12        ASSIGN                                                   !3, ~12
   16    13        INIT_ARRAY                                       ~14     !2
         14        ADD_ARRAY_ELEMENT                                ~14     !3
         15      > RETURN                                                   ~14
   17    16*     > RETURN                                                   null

End of function get_meta

Function get_header:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1o52p
function name:  get_header
number of ops:  19
compiled vars:  !0 = $url, !1 = $str, !2 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'file_get_contents'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   21     5        STRLEN                                           ~5      !1
          6        IS_SMALLER                                               0, ~5
          7      > JMPZ                                                     ~6, ->18
   22     8    >   INIT_FCALL                                               'preg_match'
          9        SEND_VAL                                                 '%2F%3Ch1.%7B31%7D%3E%28.%2A%29%5C%3C%5C%2Fh1%5C%3E%2Fi'
         10        SEND_VAR                                                 !1
         11        SEND_REF                                                 !2
         12        DO_ICALL                                                 
   23    13        FETCH_DIM_R                                      ~8      !2, 1
         14        CONCAT                                           ~9      'H1%3A+', ~8
         15        CONCAT                                           ~10     ~9, '%3Cbr%3E'
         16        ASSIGN                                                   !2, ~10
   24    17      > RETURN                                                   !2
   26    18    > > RETURN                                                   null

End of function get_header

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.49 ms | 1024 KiB | 19 Q