PHP install parsekit extension view opcode

Source: Internet
Author: User
You can also view it through VLD. For more information, see my blog. csdn. net21aspnetarticledetails7002644 install parsekit extension pecl. php. netpackageparsekit download the latest # wgetpecl. php. netgetparsekit-1.3.0.tgz installation process omitted can refer to my write http:

You can also view through VLD, please see my write http://blog.csdn.net/21aspnet/article/details/7002644 to install parsekit extension http://pecl.php.net/package/parsekit download the latest # wget http://pecl.php.net/get/parsekit-1.3.0.tgz installation process omitted can refer to my write http :/

You can also view through VLD, please see my write http://blog.csdn.net/21aspnet/article/details/7002644

Install parsekit Extension

Http://pecl.php.net/package/parsekit

Download the latest

# Wget http://pecl.php.net/get/parsekit-1.3.0.tgz

Installation Process omitted

Can refer to my write http://blog.csdn.net/21aspnet/article/details/7035392 installation apc extension is the same principle

Automatic Installation is very convenient.

Installation:

#/Usr/local/php/bin/pecl install parsekit

Configuration:

Php. ini plus extension = parsekit. so

Restart:

#/Usr/local/apache2/bin/apachectl restart

Test:

#/Usr/local/php/bin/php-r "var_dump (parsekit_compile_string ('print 1 + 1 ;'));"

Output:

array(19) {  ["type"]=>  int(4)  ["type_name"]=>  string(14) "ZEND_EVAL_CODE"  ["fn_flags"]=>  int(0)  ["num_args"]=>  int(0)  ["required_num_args"]=>  int(0)  ["pass_rest_by_reference"]=>  bool(false)  ["line_start"]=>  int(0)  ["line_end"]=>  int(0)  ["return_reference"]=>  bool(false)  ["refcount"]=>  int(1)  ["last"]=>  int(4)  ["size"]=>  int(4)  ["T"]=>  int(2)  ["last_brk_cont"]=>  int(0)  ["current_brk_cont"]=>  int(-1)  ["backpatch_count"]=>  int(0)  ["done_pass_two"]=>  bool(true)  ["filename"]=>  string(17) "Parsekit Compiler"  ["opcodes"]=>  array(4) {    [0]=>    array(8) {      ["address"]=>      int(457076436)      ["opcode"]=>      int(1)      ["opcode_name"]=>      string(8) "ZEND_ADD"      ["flags"]=>      int(197378)      ["result"]=>      array(3) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(0)      }      ["op1"]=>      array(3) {        ["type"]=>        int(1)        ["type_name"]=>        string(8) "IS_CONST"        ["constant"]=>        &int(1)      }      ["op2"]=>      array(3) {        ["type"]=>        int(1)        ["type_name"]=>        string(8) "IS_CONST"        ["constant"]=>        &int(1)      }      ["lineno"]=>      int(1)    }    [1]=>    array(7) {      ["address"]=>      int(457076556)      ["opcode"]=>      int(41)      ["opcode_name"]=>      string(10) "ZEND_PRINT"      ["flags"]=>      int(770)      ["result"]=>      array(3) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(1)      }      ["op1"]=>      array(3) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(0)      }      ["lineno"]=>      int(1)    }    [2]=>    array(7) {      ["address"]=>      int(457076676)      ["opcode"]=>      int(70)      ["opcode_name"]=>      string(9) "ZEND_FREE"      ["flags"]=>      int(271104)      ["op1"]=>      array(4) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(1)        ["EA.type"]=>        int(0)      }      ["op2"]=>      array(3) {        ["type"]=>        int(8)        ["type_name"]=>        string(9) "IS_UNUSED"        ["opline_num"]=>        string(1) "0"      }      ["lineno"]=>      int(1)    }    [3]=>    array(7) {      ["address"]=>      int(457076796)      ["opcode"]=>      int(62)      ["opcode_name"]=>      string(11) "ZEND_RETURN"      ["flags"]=>      int(16777984)      ["op1"]=>      array(3) {        ["type"]=>        int(1)        ["type_name"]=>        string(8) "IS_CONST"        ["constant"]=>        &NULL      }      ["extended_value"]=>      int(0)      ["lineno"]=>      int(1)    }  }}


Output hello word again

#/Usr/local/php/bin/php-r "var_dump (parsekit_compile_string ('print \" hello word \";'));"

Output:

array(19) {  ["type"]=>  int(4)  ["type_name"]=>  string(14) "ZEND_EVAL_CODE"  ["fn_flags"]=>  int(0)  ["num_args"]=>  int(0)  ["required_num_args"]=>  int(0)  ["pass_rest_by_reference"]=>  bool(false)  ["line_start"]=>  int(0)  ["line_end"]=>  int(0)  ["return_reference"]=>  bool(false)  ["refcount"]=>  int(1)  ["last"]=>  int(3)  ["size"]=>  int(3)  ["T"]=>  int(1)  ["last_brk_cont"]=>  int(0)  ["current_brk_cont"]=>  int(-1)  ["backpatch_count"]=>  int(0)  ["done_pass_two"]=>  bool(true)  ["filename"]=>  string(17) "Parsekit Compiler"  ["opcodes"]=>  array(3) {    [0]=>    array(7) {      ["address"]=>      int(536780564)      ["opcode"]=>      int(41)      ["opcode_name"]=>      string(10) "ZEND_PRINT"      ["flags"]=>      int(770)      ["result"]=>      array(3) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(0)      }      ["op1"]=>      array(3) {        ["type"]=>        int(1)        ["type_name"]=>        string(8) "IS_CONST"        ["constant"]=>        &string(10) "hello word"      }      ["lineno"]=>      int(1)    }    [1]=>    array(7) {      ["address"]=>      int(536780684)      ["opcode"]=>      int(70)      ["opcode_name"]=>      string(9) "ZEND_FREE"      ["flags"]=>      int(271104)      ["op1"]=>      array(4) {        ["type"]=>        int(2)        ["type_name"]=>        string(10) "IS_TMP_VAR"        ["var"]=>        int(0)        ["EA.type"]=>        int(0)      }      ["op2"]=>      array(3) {        ["type"]=>        int(8)        ["type_name"]=>        string(9) "IS_UNUSED"        ["opline_num"]=>        string(1) "0"      }      ["lineno"]=>      int(1)    }    [2]=>    array(7) {      ["address"]=>      int(536780804)      ["opcode"]=>      int(62)      ["opcode_name"]=>      string(11) "ZEND_RETURN"      ["flags"]=>      int(16777984)      ["op1"]=>      array(3) {        ["type"]=>        int(1)        ["type_name"]=>        string(8) "IS_CONST"        ["constant"]=>        &NULL      }      ["extended_value"]=>      int(0)      ["lineno"]=>      int(1)    }  }}
Summary:Two methods 1. To view the opcode of a single php statement

#/Usr/local/php/bin/php-r "var_dump (parsekit_compile_string ('print 1 + 1 ;'));"

Reference http://www.php.net/manual/zh/function.parsekit-compile-string.php


2. If you want to view the opcode of a PHP file under the website

Reference http://www.php.net/manual/zh/function.parsekit-compile-file.php

#/Usr/local/php/bin/php-r "var_dump (parsekit_compile_file ('/var/www/tb. php '));"

3. To view the opcode of a function

Reference http://www.php.net/manual/zh/function.parsekit-func-arginfo.php

function foo($bar, stdClass $baz, &$bomb, $bling = false) {
}

var_dump(parsekit_func_arginfo('foo'));
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.