I've found that both of these usages can
require('functions.php')
And
require 'functions.php'
, is it a grammar or a function in PHP? Can we implement this usage when we write our own PHP plugin? That's how you can use it.
my_custom 'parms'
。
Reply content:
I found that both of these usages can be used require('functions.php')
require 'functions.php'
, so is it a grammar or a function in PHP? Can we implement this usage when we write our own PHP plugin? That is, it can be used my_custom 'parms'
.
Grammar
Zend/zend_language_scanner.l
"Eval" {return t_eval;}
"include" {return t_include;}
"Include_once" {return t_include_once;}
"require" {return t_require;}
"require_once" {return t_require_once;}
Zend/zend_language_parser.y
Internal_functions_in_yacc:t_isset ' (' isset_variables ') ' {$$ = $;}| T_empty ' (' variable ') ' {zend_do_isset_or_isempty (Zend_isempty, &$$, &$3 tsrmls_cc);}| T_include Expr {zend_do_include_or_eval (zend_include, &$$, &$2 tsrmls_cc);}| T_include_once Expr {zend_do_include_or_eval (zend_include_once, &$$, &$2 tsrmls_cc);}| T_eval ' (' expr ') ' {zend_do_include_or_eval (Zend_eval, &$$, &$3 tsrmls_cc);}| T_require expr{zend_do_include_or_eval (Zend_require, &$$, &$2 tsrmls_cc);}| T_require_once expr{zend_do_include_or_eval (zend_require_once, &$$, &$2 tsrmls_cc);};
Zend/zend_compile.c
void zend_do_include_or_eval (int type, Znode *result, const znode *OP1 tsrmls_dc) {Zend_do_extended_fcall_begin (TSRMLS_ C); {Zend_op *opline = Get_next_op (CG (Active_op_array) tsrmls_cc); Opline->opcode = zend_include_or_eval;opline-> Result_type = Is_var;opline->result.var = Get_temporary_variable (CG (Active_op_array)); Set_node (OPLINE->OP1, OP1); Set_unused (OPLINE->OP2); opline->extended_value = type; Get_node (result, opline->result);} Zend_do_extended_fcall_end (Tsrmls_c);}
require
is a keyword in PHP.
f()
This usage is not meant to f
be a function. For example, print('hi'
it is possible, but print
not a function.