3v4l.org

run code in 300+ PHP versions simultaneously
<?php $question="<script>alert('hacked')</script>"; echo "<br>original question=",$question; $question = make_secure( $question ); echo "<br>converted question=",$question; echo "<br>converted question calling htmlspecialchars=",htmlspecialchars($question); function make_secure($data) { $data = htmlspecialchars($data); return $data; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sHIE6
function name:  (null)
number of ops:  15
compiled vars:  !0 = $question
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cscript%3Ealert%28%27hacked%27%29%3C%2Fscript%3E'
    5     1        ECHO                                                     '%3Cbr%3Eoriginal+question%3D'
          2        ECHO                                                     !0
    7     3        INIT_FCALL_BY_NAME                                       'make_secure'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        ASSIGN                                                   !0, $2
    9     7        ECHO                                                     '%3Cbr%3Econverted+question%3D'
          8        ECHO                                                     !0
   11     9        ECHO                                                     '%3Cbr%3Econverted+question+calling+htmlspecialchars%3D'
         10        INIT_FCALL                                               'htmlspecialchars'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $4      
         13        ECHO                                                     $4
   14    14      > RETURN                                                   1

Function make_secure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sHIE6
function name:  make_secure
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'htmlspecialchars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
          5      > RETURN                                                   !0
          6*     > RETURN                                                   null

End of function make_secure

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.34 ms | 1395 KiB | 15 Q