zoukankan      html  css  js  c++  java
  • compile time runtime

    php.net

    Class member variables are called "properties".
    You may also see them referred to using other terms such as "attributes" or "fields",
    but for the purposes of this reference we will use "properties".
    类的变量成员叫做"属性",或者叫"字段"、"特征",在本文档统一称为"属性"。
     They are defined by using one of the keywords public, protected, or private, followed by a normal variable declaration.
     This declaration may include an initialization, but this initialization must be a constant value--that is,
     it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.
    属性声明是由关键字 public,protected 或者 private 开头,然后跟一个普通的变量声明来组成。
    属性中的变量可以初始化,但是初始化的值必须是常数,这里的常数是指 PHP 脚本在编译阶段(E compile time)时就可以得到其值,而不依赖于运行(E run-time)时的信息才能求值。


    Within class methods non-static properties may be accessed by using -> (Object Operator): $this->property
    (where property is the name of the property).

    Static properties are accessed by using the :: (Double Colon): self::$property.


    The pseudo-variable $this is available inside any class method  when that method is called from within an object context. 

    $this is a reference to the calling object (usually the object to which the method belongs, but possibly another object,


    if the method is called statically from the context of a secondary object).
    当一个方法在类定义内部被调用时,有一个可用的伪变量 $this。


    $this 是一个到主叫对象的引用(通常是该方法所从属的对象,但如果是从第二个对象静态调用时也可能是另一个对象)。


    It is possible to define constant values on a per-class basis remaining the same and unchangeable.


    Constants differ from normal variables in that you don't use the $ symbol to declare or use them.


    The default visibility of class constants is public.


    The value must be a constant expression, not (for example) a variable, a property, or a function call.


    可以把在类中始终保持不变的值定义为常量。在定义和使用常量的时候不需要使用 $ 符号。
    常量的值必须是一个定值,不能是变量,类属性,数学运算的结果或函数调用。

  • 相关阅读:
    Docker 第一篇 认识Docker 的作用好处
    AspNetCoreApi 跨域处理
    VS 2017 发布:由于构建错误,发布失败
    iTerm2 cheatsheet (from github)
    find命令:忽略一个目录或者多个目录
    git push throws error: RPC failed; result=22, HTTP code = 411的解决办法
    sourceTree 一款图形化GIT工具
    生产力工具之vimwiki 和 calendar
    source : not found 原因及解决办法
    亚马逊开放机器学习系统源代码:挑战谷歌TensorFlow
  • 原文地址:https://www.cnblogs.com/rsapaper/p/5861517.html
Copyright © 2011-2022 走看看