タグ

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

  • 関連タグはありません

タグの絞り込みを解除

PROGRAMMINGとProgrammingとmanualに関するItisangoのブックマーク (94)

  • 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 は呼び出し元スクリプトのディレクトリと現在の作業ディレクトリも探します
  • PHP: require - 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: require - Manual
    Itisango
    Itisango 2023/08/10
    include とほぼ同じですが、失敗した場合に E_COMPILE_ERROR レベルの致命的なエラーも発生するという点が異なります。 つまり、スクリプトの処理がそこで止まってしまうということです。一方 include の場合は、警告 (E_WARNING)
  • PHP: return - 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: return - Manual
    Itisango
    Itisango 2023/08/10
    グローバルスコープで呼び出されると、現在実行中のスクリプトが終了 します。もしそのスクリプトが include もしくは require されたものである場合、制御は呼び出し元 のファイルに戻ります
  • PHP: match - 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: match - Manual
    Itisango
    Itisango 2023/08/10
    (==)ではなく、 型と値の一致チェック(===) に基づいて行われます。 match 式は PHP 8.0.0 以降で利用可能です。 例1 match 式の構造 <?php $return_value = match (制約式) { 単一の条件式 => 返却式, 条件式1, 条件式2 => 返却式, };
  • PHP: switch - Manual

    switch (PHP 4, PHP 5, PHP 7, PHP 8) switch文は、同じ式を用いてIF文を並べたのに似ています。 同じ変数を異なる値と比較し、値に応じて異なったコードを実行したいと 思うことがしばしばあるかと思います。 switch文は、まさにこのためにあるのです。 注意: 他の言語とは違って、 continue命令は switch にも適用され、breakと同じ動作をします。 ループの内部で switch を使用しており、 外側のループの処理を続行させたい場合には、continue 2 を使用してください。 注意: switch/case が行うのは、 緩やかな比較 であることに注意しましょう。 次の二つの例は、同じことを二つの異なった方法で書いたものです。 一つは、if と elseif文を、 もう一つはswitch文を使っています。 どちらも、出力は同じです。

    PHP: switch - Manual
    Itisango
    Itisango 2023/08/10
    case に与える値は、式であっても構いません。 しかし、式はそれ自体が実行され、 その結果が swtich に与えた値と緩やかに比較されます。 これは、switch に与える値の複雑な評価には使えないということです。
  • PHP: continue - Manual

    continue (PHP 4, PHP 5, PHP 7, PHP 8) continue は、ループ構造において現在の繰り返しループ の残りの処理をスキップし、条件式を評価した後に 次の繰り返しの最初から実行を続けるために使用されます、 注意: PHP では、continue の動作に関しては switch 文がループ構造とみなされます。 continue に引数を渡さなかった場合の動きは break と同じですが、間違いの元なので警告が生成されます。 switch がループ内にある場合、 continue 2 とすると、外側のループの次回の処理から続行します。 continueでは、オプションの引数で 処理をスキップするループ構造のレベルの数を指定できます。 デフォルト値は 1 で、 これは現在のループの終了地点までスキップします。 <?php $arr = ['zero', 'on

    PHP: continue - Manual
    Itisango
    Itisango 2023/08/10
    PHP では、continue の動作に関しては switch 文がループ構造とみなされます。 continue に引数を渡さなかった場合の動きは break と同じですが、間違いの元なので警告が生成されます
  • PHP: foreach - 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: foreach - Manual
    Itisango
    Itisango 2023/08/10
    二種類の構文があります。 foreach (iterable_expression as $value) 文 foreach (iterable_expression as $key => $value) 文 最初の形式は、iterable_expression で指定した反復可能な値に 関してループ処理を行います。
  • PHP: for - Manual

    for (PHP 4, PHP 5, PHP 7, PHP 8) for ループは、PHPで最も複雑なループです。 for は、Cのforループと同様に動作します。 forループの構文は、次のようになります。 最初の式(式1)は、ループ開始時に無条件に 評価(実行)されます。 各繰り返しの開始時に、式2が評価されます。 その式の値がtrueが場合、ループは継続され、括弧 内の文が実行されます。値がfalseの場合、ループの 実行は終了します。 各繰り返しの後、式3が評価(実行)されます。 各式は空にすることもできますし、複数の式をカンマで区切って指定することもできます。 式2 でカンマ区切りの式を使用すると、 すべての式を評価します。しかし、結果として取得するのは最後の式の結果となります。 式2 を空にすると、無限実行ループになります (PHP は、この状態を C 言語のように暗黙の内に

    PHP: for - Manual
    Itisango
    Itisango 2023/08/10
    PHPは、forループ用に"コロン構文"もサポートします。 for loops. for (式1; 式2; 式3): 文; ... endfor;
  • PHP: while - 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: while - Manual
    Itisango
    Itisango 2023/08/10
    if文と同様に、波括弧で複数の文を囲うか、 以下に示す別の構文を用いることにより、同じwhile ループの中に複数の文をグループ化することができます。 while (式): 文 ... endwhile;
  • 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: elseif/else if - Manual

    elseif/else if (PHP 4, PHP 5, PHP 7, PHP 8) elseifは、その名前から分かるように、if とelseの組み合わせです。elseifは、 elseのように、元のif式の値が falseの場合に別の文を実行するようにif 文を拡張します。 しかし、elseとは異なり、elseif式が trueの場合にのみ代わりの式を実行します。 例えば、次のコードは、aはbより大きい、 aはbに等しい、 aはbより小さいを出力します。 <?php if ($a > $b) { echo "aはbより大きい"; } elseif ($a == $b) { echo "aはbと等しい"; } else { echo "aはbより小さい"; } ?> 複数の elseif を同じ if 文の中で使用することができます。 true と評価された最初の elseif 式を実

    PHP: elseif/else if - 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
  • PHP: 配列演算子 - Manual

    <?php $a = array("a" => "apple", "b" => "banana"); $b = array("a" => "pear", "b" => "strawberry", "c" => "cherry"); $c = $a + $b; // Union of $a and $b echo "Union of \$a and \$b: \n"; var_dump($c); $c = $b + $a; // Union of $b and $a echo "Union of \$b and \$a: \n"; var_dump($c); $a += $b; // Union of $a += $b is $a and $b echo "Union of \$a += \$b: \n"; var_dump($a); ?> Union of $a and $b: array

    PHP: 配列演算子 - Manual
    Itisango
    Itisango 2023/08/10
    配列等価不等価比較ができる。
  • PHP: 論理演算子 - Manual

    <?php // -------------------- // foo() は決してコールされることはありません。これらの演算子は短絡評価を行うからです。 $a = (false && foo()); $b = (true || foo()); $c = (false and foo()); $d = (true or foo()); // -------------------- // "||" の優先順位は "or" より高くなります // $e に代入されるのは、(false || true) の評価結果です // これは、次の式と同様です: ($e = (false || true)) $e = false || true; // $f に false を代入してから "or" 演算子を評価します // これは、次の式と同様です: (($f = false) or true) $

    PHP: 論理演算子 - Manual
    Itisango
    Itisango 2023/08/10
    // foo() は決してコールされることはありません。これらの演算子は短絡評価を行うからです。 $a = (false && foo()); $b = (true || foo()); $c = (false and foo()); $d = (true or foo());
  • 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
    加減算子は、数値や文字列にしか影響を及ぼしません。 配列やオブジェクト、boolean、そしてリソースには、何も変更を加えません。 同じく null に減算子を適用しても何も起こりませんが、null に加算子を 適用すると 1
  • 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
    バッククォートの 中身をシェルコマンドとして実行しようとします。出力が返されます (すなわち、出力を単にダンプするのではなく、変数に代入することが できます) 。 バッククォート演算子の使用は shell_exec() と等価
  • PHP: エラー制御演算子 - Manual

    エラー制御演算子 PHP はエラー制御演算子(@)をサポートしています。 PHP の式の前に付けた場合、 その式により生成されたエラーメッセージは無視されます。 set_error_handler() で自作のエラーハンドラを設定した場合は エラー制御演算子があってもそのエラーハンドラがコールされます。 警告 PHP 8.0.0 より前のバージョンでは、 エラー制御演算子(@)でエラーが無視されている場合、 カスタムのエラーハンドラでコールされた error_reporting() が常に 0 を返していました。 PHP 8.0.0 以降では、以下の (ビット和の) 値を返すようになっています: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE

    PHP: エラー制御演算子 - Manual
    Itisango
    Itisango 2023/08/10
    PHP の式の前に付けた場合、 その式により生成されたエラーメッセージは無視されます。set_error_handler() で自作のエラーハンドラを設定した場合は エラー制御演算子があってもそのエラーハンドラがコールされます。
  • 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
    ==と===との違いは、Javascriptに似ている。