PHP: parsekit_compile_string - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

parsekit_func_arginfo parsekit_compile_file

Last updated: Sat, 27 Jan 2007

view this page in

# parsekit_compile_string

(PECL)

parsekit_compile_string -- Compile a string of PHP code and return the resulting op array

## Описание

array parsekit_compile_string ( string phpcode [, array &errors [, int options]] )

Внимание
Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.

## Список параметров

`phpcode`

  A string containing phpcode. Similar to the argument to eval().

`errors`

  A 2D hash of errors (including fatal errors) encountered during compilation. Returned by reference.

`options`

  One of either `PARSEKIT_QUIET` or `PARSEKIT_SIMPLE`. To produce varying degrees of verbosity in the returned output.

## Возвращаемые значения

Returns a complex multi-layer array structure as detailed below.

## Примеры

Пример 1. parsekit_compile_string() example

`<?php
$ops = parsekit_compile_string('
echo "Foo\n";
', $errors, PARSEKIT_QUIET);
var_dump($ops);
?>`

Результат выполнения данного примера:

    array(20) {
      ["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)
      ["uses_this"]=>
      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(0)
      ["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) {
        [8594800]=>
        array(5) {
          ["opcode"]=>
          int(40)
          ["opcode_name"]=>
          string(9) "ZEND_ECHO"
          ["flags"]=>
          int(768)
          ["op1"]=>
          array(3) {
            ["type"]=>
            int(1)
            ["type_name"]=>
            string(8) "IS_CONST"
            ["constant"]=>
            &string(4) "Foo
    "
          }
          ["lineno"]=>
          int(2)
        }
        ["859484C"]=>
        array(6) {
          ["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(3)
        }
        [8594898]=>
        array(4) {
          ["opcode"]=>
          int(149)
          ["opcode_name"]=>
          string(21) "ZEND_HANDLE_EXCEPTION"
          ["flags"]=>
          int(0)
          ["lineno"]=>
          int(3)
        }
      }
    }

## Смотрите также

parsekit_compile_file()

add a note User Contributed Notes
parsekit_compile_string
There are no user contributed notes for this page.
parsekit_func_arginfo parsekit_compile_file

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST