3v4l.org

run code in 300+ PHP versions simultaneously
<?php $post = (object)['content' => '<style>some random css</style>the text I really want']; $doc = new DOMDocument(); $doc->loadHTML($post->content); echo $doc->getElementsByTagName('body')->item(0)->nodeValue . "\n"; echo preg_replace('#<style>.*?</style>#', '', $post->content);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GamSK
function name:  (null)
number of ops:  27
compiled vars:  !0 = $post, !1 = $doc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          8  ~2      <array>
          1        ASSIGN                                                   !0, ~2
    4     2        NEW                                              $4      'DOMDocument'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
    5     5        INIT_METHOD_CALL                                         !1, 'loadHTML'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_OBJ_FUNC_ARG                               $7      !0, 'content'
          8        SEND_FUNC_ARG                                            $7
          9        DO_FCALL                                      0          
    6    10        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         11        SEND_VAL_EX                                              'body'
         12        DO_FCALL                                      0  $9      
         13        INIT_METHOD_CALL                                         $9, 'item'
         14        SEND_VAL_EX                                              0
         15        DO_FCALL                                      0  $10     
         16        FETCH_OBJ_R                                      ~11     $10, 'nodeValue'
         17        CONCAT                                           ~12     ~11, '%0A'
         18        ECHO                                                     ~12
    7    19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAL                                                 '%23%3Cstyle%3E.%2A%3F%3C%2Fstyle%3E%23'
         21        SEND_VAL                                                 ''
         22        FETCH_OBJ_R                                      ~13     !0, 'content'
         23        SEND_VAL                                                 ~13
         24        DO_ICALL                                         $14     
         25        ECHO                                                     $14
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.52 ms | 1002 KiB | 14 Q