タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

PHPとProgrammingとITに関するItisangoのブックマーク (58)

  • PHP: クラスのオートローディング - Manual

    クラスのオートローディング オブジェクト指向アプリケーションを作成する開発者の多くは、 クラス定義毎に一つのPHPソースファイルを作成します。 最大の問題は、各スクリプトの先頭に、必要な読み込みを行う長いリストを 記述する必要があることです(各クラスについて一つ)。 spl_autoload_register() 関数を使うと、 任意の数のオートローダーを登録でき、 クラスやインターフェイスが定義されていなくても自動的に読み込めるようになります。 オートローダーを登録すれば、PHPがエラーで止まる前にクラスをロードする最後の チャンスが与えられます。 クラスに類似した言語構造は、同じやり方でオートロードできます。 これには、クラス、インターフェイス、トレイト、列挙型が含まれます。 警告 PHP 8.0.0 より前のバージョンでは、 __autoload() 関数でもクラスやインターフェイス

    PHP: クラスのオートローディング - Manual
    Itisango
    Itisango 2023/08/10
    spl_autoload_register() 関数を使うと、 任意の数のオートローダーを登録でき、 クラスやインターフェイスが定義されていなくても自動的に読み込めるようになります。
  • PHP: クラス定数 - Manual

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

    PHP: クラス定数 - Manual
    Itisango
    Itisango 2023/08/10
    クラス定数は、子クラスで再定義することもできます。 PHP 8.1.0 以降では、final として定義されたクラス定数は、子クラスで再定義できません。インターフェイスに 定数 を持たせることもできます。
  • 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
    Itisango
    Itisango 2023/08/10
    static でないプロパティにアクセスするには -> (オブジェクト演算子) を使って $this->property のようにします 。 staticプロパティへのアクセスには :: (ダブルコロン) を使って self::$property のようにします。
  • PHP: クラスの基礎 - Manual

    class 各クラスの定義は、classキーワードで始まり、クラス名が続きます。 そしてその後に波括弧のペアが続き、 その中にはクラスのプロパティとメソッドの定義を記述します。 クラス名には、PHP の予約語 以外でラベルとして有効なあらゆる名前を使用することができます。 PHP 8.4.0 以降では、アンダースコア (_) 1文字のみのクラス名は非推奨となりました。 有効なクラス名は、先頭が文字あるいはアンダースコアで始まり、 その後に任意の数の文字/数字/アンダースコアが続くものです。 正規表現で表すと、 ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$ のようになります。 クラスの中には、 定数 や 変数 ("プロパティ" といいます) そして関数 ("メソッド" といいます) を含めることができます。

    PHP: クラスの基礎 - Manual
    Itisango
    Itisango 2023/08/10
    クラスにreadonly を指定することができます。 クラスに対して readonly を指定すると、 宣言されている全ての プロパティに対して readonly を指定した ことになり、 かつ 動的なプロパティ の作成を禁止したことになります
  • 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
    Itisango
    Itisango 2023/08/10
    関数名では、単語の間にアンダースコアを使用します。クラスの場合は、 キャメルケース (camelCase) 形式や パスカルケース (PascalCase) 形式を使います。
  • 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
    Itisango
    Itisango 2023/08/10
    あなたが書く PHP コード中の識別子によりよい名前をつけるための手引きです。 グローバル名前空間のシンボルを作成するコードでシンボルの名前を決める際には、 以下のガイドラインを考慮することが重要です
  • 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
    Itisango
    Itisango 2023/08/10
    機能には アクセス権、 abstract クラスやメソッド、 final クラスやメソッド、 新たな マジックメソッド、 インターフェイス、 オブジェクトのクローン作成 などがあります。
  • 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
    Itisango
    Itisango 2023/08/10
    アロー関数は fn (argument_list) => expr という形で記述します。アロー関数は 無名関数 と同じ機能をサポートしていますが、 親のスコープで使える変数が常に自動で使える点だけが異なります
  • 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
    Itisango
    Itisango 2023/08/10
    無名関数はクロージャとも呼ばれ、 関数名を指定せずに関数を作成できるようにするものです。 callable パラメータとして使う際に便利です。無名関数の実装には Closure クラスを使っています
  • PHP: Manual

    PHP の振る舞いの変更APCu — APC User CacheComponereエラー処理 — エラー処理およびログ記録FFI — Foreign Function InterfaceOPcache出力制御 — 出力バッファリング制御PHP Options/Info — PHP オプションと情報phpdbg — 対話的な PHP デバッガrunkit7uopz — Zend に対するユーザー操作WinCache — PHP 用の Windows キャッシュXhprof — 階層型プロファイラYac音声フォーマットの操作OpenAL — OpenAL 音声バインディング認証サービスRadiusコマンドライン関連Readline圧縮およびアーカイブBzip2LZFPharRar — Rar アーカイブZipZlib — Zlib 圧縮暗号Hash — HASH メッセージダイジェストフレー

    PHP: Manual
    Itisango
    Itisango 2023/08/10
    PHP の振る舞いの変更 APCu — APC User Cache Componere エラー処理 — エラー処理およびログ記録 FFI — Foreign Function Interface OPcache 出力制御 — 出力バッファリング制御 PHP Options/Info — PHP オプションと情報 phpdbg — 対話的な PHP デバ
  • PHP: function_exists - 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: function_exists - Manual
  • 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
    Itisango
    Itisango 2023/08/10
    多くの関数と言語構造を持っています。他にも コンパイル済みの特定のPHP拡張モジュールを必要とする関数があります。 もしコンパイルされていなければ"undefined function(未定義の関数)" として致命的エラーを発する
  • PHP: 可変関数 - Manual

    可変関数 PHP は可変関数(variable functions)の概念をサポートします。 これにより、変数名の後に括弧が付いている場合、その値が何であろうと PHPは、同名の関数を探し実行を試みます。 この機能は、コールバック、関数テーブル等を実装するために使用可能です。 可変関数は、echo, print, isset(), empty(), include, require のような言語構造と組み合わせて使用する ことはできません。これらの言語構造を可変変数として使うには 独自のラッパー関数を使う必要があります。 <?php function foo() { echo "In foo()<br />\n"; } function bar($arg = '') { echo "In bar(); argument was '$arg'.<br />\n"; } // これは、echo

    PHP: 可変関数 - Manual
    Itisango
    Itisango 2023/08/10
    可変関数(variable functions)の概念をサポートします。 変数名の後に括弧が付いている場合、その値が何であろうと PHPは、同名の関数を探し実行を試みます。 コールバック、関数テーブル等を実装するために使用可能です
  • 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
    Itisango
    Itisango 2023/08/10
    配列やオブジェクトを含むあらゆる型を返すことができます。 これにより、関数の実行を任意の箇所で終了し、その関数を呼び出した 箇所に制御を戻すことが出来ます。注意:return を省略した場合は null を返します。
  • 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 : 可変長引数リスト
    Itisango
    Itisango 2023/08/10
    左から右の順番で行われます(先行評価)。 PHP は、値渡し(デフォルト)、 リファレンス渡し、 デフォルト引数値 をサポートしています。また、 可変長引数リスト や、 名前付き引数 もサポートしています。
  • 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
    Itisango
    Itisango 2023/08/10
    function foo($arg_1, $arg_2, /* ..., */ $arg_n) { echo "関数の例\n"; return $retval; }
  • PHP: goto - 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: goto - Manual
    Itisango
    Itisango 2023/08/10
    対象となるラベルは同じファイル上の同じコンテキストになければなりません。 つまり、関数やメソッドの外に飛び出したり 関数やメソッドの中に突入したりすることはできないということです
  • PHP: include_once - Manual

    include_once (PHP 4, PHP 5, PHP 7, PHP 8) include_once 式は、スクリプトの実行時に指定 したファイルを読み込み評価します。この動作は include 式と似ていますが、ファイルからのコー ドが既に読み込まれている場合は、再度読み込まれずに include_once は true を返すという点のみが異なります。その名が示す通り、ファイルは一度しか読み込まれません。 include_once は、スクリプトの実行時に同じファイ ルが複数回読み込まれ、評価される可能性がある場合に、関数の再定義や 変数値の再代入といった問題を回避するために一回だけ読み込ませるため に使用します。 この関数の動作についての情報は include のドキュメントを参照ください。

    PHP: include_once - Manual
    Itisango
    Itisango 2023/08/10
    include_once は、スクリプトの実行時に同じファイ ルが複数回読み込まれ、評価される可能性がある場合に、関数の再定義や 変数値の再代入といった問題を回避するために一回だけ読み込ませるため に使用します。
  • PHP: require_once - Manual

    If your code is running on multiple servers with different environments (locations from where your scripts run) the following idea may be useful to you: a. Do not give absolute path to include files on your server. b. Dynamically calculate the full path (absolute path) Hints: Use a combination of dirname(__FILE__) and subsequent calls to itself until you reach to the home of your '/index.php'. The

    PHP: require_once - Manual
    Itisango
    Itisango 2023/08/10
    require_once 式は require とほぼ同じ意味ですが、 ファイルがすでに読み込まれているかどうかを PHP がチェックするという点が異なります。 すでに読み込まれている場合はそのファイルを読み込みません
  • PHP: include - 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: include - Manual
    Itisango
    Itisango 2023/08/10
    指定されたパスから行います。パスを指定しない場合は、 include_path の設定を利用します。 ファイルが include_path に見つからないときは、include は呼び出し元スクリプトのディレクトリと現在の作業ディレクトリも探します