タグ

_constantsに関するoverdrive_596のブックマーク (4)

  • PHP の PATH_SEPARATOR について

    PHP の PATH_SEPARATOR について 2005-09-06-3: [PHP][Code] PHP で set_include_path() を使って,パスを追加するとき Windows 系と,UNIX 系では パスの区切り文字が違うので,今までは if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { set_include_path(get_include_path() . ':./libs'); } else { set_include_path(get_include_path() . ';./libs'); } とかやっていた. 最近 PATH_SEPARATOR という定数を知って set_include_path(get_include_path() . PATH_SEPARATOR . './libs'); で幸せにな

    overdrive_596
    overdrive_596 2008/04/11
    PATH_SEPARATORが定義されていない場合
  • PHP: 定義済みの定数 - Manual

    Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Su

    PHP: 定義済みの定数 - Manual
  • PHP: クラス定数 - Manual

    クラス定数 値が変更できない 定数 をクラス内に定義することができます。 クラス定数のデフォルトのアクセス範囲は public です。 注意: クラス定数は、子クラスで再定義することもできます。 PHP 8.1.0 以降では、final として定義されたクラス定数は、子クラスで再定義できません。 インターフェイスに定数を持たせることもできます。 インターフェイスについてのドキュメント で例を御覧ください。 変数を用いてクラスを参照することも可能です。 変数の値に (self や parent、 static といった) キーワードを指定することはできません。 クラス定数はクラス単位で割り当てられるものです。インスタンス単位ではないことに注意しましょう。 <?php class MyClass { const CONSTANT = 'constant value'; function sho

    PHP: クラス定数 - Manual
    overdrive_596
    overdrive_596 2008/04/11
    const:オブジェクト定数、php5から
  • PHP: 自動的に定義される定数 - Manual

    The __CLASS__ magic constant nicely complements the get_class() function. Sometimes you need to know both: - name of the inherited class - name of the class actually executed Here's an example that shows the possible solution: <?php class base_class { function say_a() { echo "'a' - said the " . __CLASS__ . "<br/>"; } function say_b() { echo "'b' - said the " . get_class($this) . "<br/>"; } } class

    PHP: 自動的に定義される定数 - Manual
    overdrive_596
    overdrive_596 2008/04/10
    定数で覚えておく
  • 1