Whether the require in php is a function or a syntax

Source: Internet
Author: User
I found that require (& #039; functions. php & #039;) and require & #039; functions. php & #039;, is it a syntax or a function in php? Can we achieve this when writing the php plug-in on our own? That is, you can use my_custom & #039; parms & #039 ;. I have found that both methods can be used. require('functions.php')And require 'functions.php'In php, is it a syntax or a function? Can we achieve this when writing the php plug-in on our own? That is, it can be used in this way. my_custom 'parms'.

Reply content:

I have found that both methods can be used.require('functions.php')Andrequire 'functions.php'In php, is it a syntax or a function? Can we achieve this when writing the php plug-in on our own? That is, it can be used in this way.my_custom 'parms'.

Syntax
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 ')' { $$ = $3; }|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);}

requireIs a keyword in PHP.

f()This usage does not meanfYes. For example,print('hi'Yes,printNot a function.

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.