タグ

ブックマーク / www.php.net (140)

  • PHP: 新機能 - Manual

    スカラー型宣言 スカラー 型宣言 には二つの方式があります。デフォルトの自動変換(coercive) モードと、 厳密に判断する strict モードです。 パラメータとして、 文字列 (string)、整数 (int)、浮動小数点数 (float)、boolean (bool) といった型をいずれかの方式で強制できるようになりました。 これらは、PHP 5 で導入された型宣言 (クラス名やインターフェイス、配列そして callable) を強化するものです。 <?php // デフォルトのモード function sumOfInts(int ...$ints) { return array_sum($ints); } var_dump(sumOfInts(2, '3', 4.1));

    PHP: 新機能 - Manual
    iww
    iww 2024/08/17
    Null合体演算子 は nullにのみ対応しているので 0とかfalseとかは値
  • PHP: ReflectionProperty::getDocComment - 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

    iww
    iww 2023/10/26
    プログラムに書かれているコメントを読む関数! そんなのあるのか
  • PHP: mktime - 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: mktime - Manual
    iww
    iww 2023/09/10
    『警告 引数の順番が変なので注意して下さい』 やっぱ変だよなアメリカ式。 ほんとクソ
  • 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
    iww
    iww 2023/09/10
    strtotime() が理解してくれる書式一覧。 書いてないけど 20230123123456 も大丈夫
  • PHP: hypot - 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: hypot - Manual
    iww
    iww 2023/08/31
    直角三角形の斜辺の長さを求める関数。 なぜこんなピンポイントな関数が存在するのか
  • 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
  • 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
    iww
    iww 2023/02/14
    __DIR__ 『ルートディレクトリである場合を除き、ディレクトリ名の末尾にスラッシュはつきません。』
  • PHP: fgets - 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: fgets - Manual
    iww
    iww 2022/10/20
    『読み出しは、length - 1 バイト読み出したか、(戻り値に含まれる) 改行文字を検出したか、EOF に達したかのいずれかが起こった時点で終了します。』 lengthバイト読まない
  • PHP: 下位互換性のない変更点 - Manual

    その他の下位互換性のない変更 match が予約語になりました。 mixed が予約語になりました。 よって、クラスやインターフェイス、 トレイトの名前として使えなくなっています。 名前空間の中であっても同様です。 アサーションに失敗すると、デフォルトで例外をスローするようになりました。 古い振る舞いを望む場合、php.ini で assert.exception=0 と設定できます。 クラス名と同じ名前のメソッドは、コンストラクタと解釈されなくなりました。 __construct() メソッドを代わりに使って下さい。 static でないメソッドを、staticメソッドとしてコールできる機能が削除されました。 static でないメソッドをクラス名を使ってチェックした場合、 is_callable() は失敗します。 (オブジェクトのインスタンスを使ってチェックしなければいけません) (

    PHP: 下位互換性のない変更点 - Manual
    iww
    iww 2022/10/19
    ここでこの互換性無くしてくるのは困るな
  • PHP: str_contains - 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

    iww
    iww 2022/09/26
    空文字列は必ずヒットする
  • PHP: array_map - 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: array_map - Manual
    iww
    iww 2022/05/28
    配列に適用して戻り値で入れ替えるやつ。 trimとか用
  • PHP: fopen - Manual

    パラメータ filename filename が "スキーム://..." の形式である場合、 それは URL とみなされ、PHP はそのプロトコルのハンドラ (ラッパーともいいます) を探します。 もしもそのプロトコルに対するラッパーが登録されていない場合、 PHP はスクリプトに潜在的な問題があることを示す NOTICE を発行したうえで、 filename を通常のファイルとみなしてオープンすることを試みます。 PHP は、filename がローカルのファイルを示しているとみなすと、 そのファイルへのストリームをオープンします。 そのファイルはPHPからアクセスできるものでなければなりません。 ファイルのパーミッションが (パラメータで指定された) アクセスを許可されているかどうか確認する必要があります。 open_basedir を有効にしている場合は、更なるアクセス制限が加え

    PHP: fopen - Manual
    iww
    iww 2022/05/27
    $use_include_path を指定しないとinclude_pathをたどらない
  • PHP: shell_exec - 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: shell_exec - Manual
    iww
    iww 2022/03/30
    『この関数は バッククォート演算子 と等価です。』
  • PHP: ZipArchive::getStream - 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

    iww
    iww 2022/03/27
    日本語のZIPファイル名が解凍時に文字化けすることがあり、そのときは文字化けのせいでgetStreamも動作しない。 これはPHP7.0.8以降にならないと回避策すらない
  • 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
    iww
    iww 2022/03/27
    『ZipArchive::FL_ENC_RAW (int) 何も手を加えない文字列を取得します。PHP 7.0.8 以降で利用可能です。』
  • 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
    iww
    iww 2022/03/25
    LOG_LOCAL0 とかのファシリティは定義済み。 すでに3ビットシフト済みの数値なので あとはORするだけ
  • PHP: intval - 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

    iww
    iww 2022/03/25
    intval(false) は 0
  • PHP: mb_convert_encoding - 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: mb_convert_encoding - Manual
    iww
    iww 2021/12/22
    『7.2.0 この関数は、 string に 配列を受け入れるようになりました。 これより前のバージョンでは、文字列のみがサポートされていました。』 いつの間にそんな機能が
  • PHP - 型の比較表

    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 - 型の比較表
    iww
    iww 2021/06/28
    便利。 そんなに複雑でもない
  • PHP: ftp_pasv - 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

    iww
    iww 2021/06/16
    ACTIVEに戻すときはfalse