3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name="why";//声明变量$name,并初始化 function echoName1() { //在函数echoName1()里使用global来声明$name global $name; echo "the first name is ".$name."<br>"; } function echoName2() { //在函数echoName2()里没有使用global来声明$name echo "the second name is ".$name."<br>"; } echoName1(); echoName2(); $last_name = "O'Keefe"; echo $sql = "select * from users where last_name = '" . addslashes($last_name) . "'"; class Person { //下面是人的成员属性 var $name; //人的名子 var $sex; //人的性别 var $age; //人的年龄 //定义一个构造方法参数为属性姓名$name、性别$sex和年龄$age进行赋值 function __construct($name = "", $sex = "", $age = "") { $this->name = $name; $this->sex = $sex; $this->age = $age; } //这个人可以说话的方法, 说出自己的属性 function say() { echo "我的名子叫:" . $this->name . " 性别:" . $this->sex . " 我的年龄是:" . $this->age . "<br>"; } } $p1 = new Person("张三", "男", 20); $p1_string = serialize($p1); //把一个对象串行化,返一个字符串 echo $p1_string . "<br>"; //串行化的字符串我们通常不去解析 $p2 = unserialize($p1_string); //把一个串行化的字符串反串行化形成对象$p2 $p2->say();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3cI
function name:  (null)
number of ops:  32
compiled vars:  !0 = $name, !1 = $last_name, !2 = $sql, !3 = $p1, !4 = $p1_string, !5 = $p2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 'why'
   18     1        INIT_FCALL                                               'echoname1'
          2        DO_FCALL                                      0          
   19     3        INIT_FCALL                                               'echoname2'
          4        DO_FCALL                                      0          
   21     5        ASSIGN                                                   !1, 'O%27Keefe'
   22     6        INIT_FCALL                                               'addslashes'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $10     
          9        CONCAT                                           ~11     'select+%2A+from+users+where+last_name+%3D+%27', $10
         10        CONCAT                                           ~12     ~11, '%27'
         11        ASSIGN                                           ~13     !2, ~12
         12        ECHO                                                     ~13
   44    13        NEW                                              $14     'Person'
         14        SEND_VAL_EX                                              '%E5%BC%A0%E4%B8%89'
         15        SEND_VAL_EX                                              '%E7%94%B7'
         16        SEND_VAL_EX                                              20
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $14
   45    19        INIT_FCALL                                               'serialize'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !4, $17
   46    23        CONCAT                                           ~19     !4, '%3Cbr%3E'
         24        ECHO                                                     ~19
   47    25        INIT_FCALL                                               'unserialize'
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !5, $20
   48    29        INIT_METHOD_CALL                                         !5, 'say'
         30        DO_FCALL                                      0          
         31      > RETURN                                                   1

Function echoname1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3cI
function name:  echoName1
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   BIND_GLOBAL                                              !0, 'name'
   11     1        CONCAT                                           ~1      'the+first+name+is+', !0
          2        CONCAT                                           ~2      ~1, '%3Cbr%3E'
          3        ECHO                                                     ~2
   12     4      > RETURN                                                   null

End of function echoname1

Function echoname2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3cI
function name:  echoName2
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   CONCAT                                           ~1      'the+second+name+is+', !0
          1        CONCAT                                           ~2      ~1, '%3Cbr%3E'
          2        ECHO                                                     ~2
   17     3      > RETURN                                                   null

End of function echoname2

Class Person:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3cI
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $sex, !2 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV_INIT                                        !0      ''
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      ''
   33     3        ASSIGN_OBJ                                               'name'
          4        OP_DATA                                                  !0
   34     5        ASSIGN_OBJ                                               'sex'
          6        OP_DATA                                                  !1
   35     7        ASSIGN_OBJ                                               'age'
          8        OP_DATA                                                  !2
   36     9      > RETURN                                                   null

End of function __construct

Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3cI
function name:  say
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        CONCAT                                           ~1      '%E6%88%91%E7%9A%84%E5%90%8D%E5%AD%90%E5%8F%AB%EF%BC%9A', ~0
          2        CONCAT                                           ~2      ~1, '+%E6%80%A7%E5%88%AB%EF%BC%9A'
          3        FETCH_OBJ_R                                      ~3      'sex'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+%E6%88%91%E7%9A%84%E5%B9%B4%E9%BE%84%E6%98%AF%EF%BC%9A'
          6        FETCH_OBJ_R                                      ~6      'age'
          7        CONCAT                                           ~7      ~5, ~6
          8        CONCAT                                           ~8      ~7, '%3Cbr%3E'
          9        ECHO                                                     ~8
   41    10      > RETURN                                                   null

End of function say

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.57 ms | 1394 KiB | 21 Q