is require in PHP a function or a grammar?

Source: Internet
Author: User
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);}

requireis 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.

  • 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.