タグ

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

タグの絞り込みを解除

DevelopmentとWebに関するItisangoのブックマーク (685)

  • 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: declare - 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

    Itisango
    Itisango 2023/08/10
    現在のところ、使用できるディレクティブは ticks ( ticksに関しては以下を参照ください)、 encoding (encoding に関しては以下を参照ください)、 strict_types (型宣言のページの 厳密な型付け も参照ください) です
  • 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

    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: 型演算子 - 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) $

    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

    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に似ている。
  • 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

    Itisango
    Itisango 2023/08/10
    剰余演算子は、まず両方のオペランドを整数に直してから処理を行います。 浮動小数点の剰余については fmod() を参照ください。
  • PHP: 式 - Manual

    式 式は、PHP における最も重要なビルディングブロックです。PHPにおいては、ほとんど全てのものは式で記述されます。 最も簡単で最も正確な式の定義は、"値があるもの全て"です。 考えられる簡単な例は、定数と変数です。 $a = 5 と入力すると、 $a に 5 を代入することになります。 5 は、明らかに、 5 という値です。 言葉を変えると 5 は 5 という値を有する式なのです。 (この場合、5 は整数定数です。) この代入の後、$a の値は、5 であることが期待されます。 よって、$b = $a と書いた場合、$b = 5 と書いたのと 同じように動作することが期待されます。 言い換えると $a は 5 という値を持つ式なのです。 全てが正しく動作する場合、何が起こるかをこのことが正確に表現しています。 式をもう少し複雑にしたのが関数です。 例えば、次の関数を考えてみましょう。 あ

    Itisango
    Itisango 2023/08/10
    式は、PHP における最も重要なビルディングブロックです。PHPにおいては、ほとんど全てのものは式で記述されます。 最も簡単で最も正確な式の定義は、"値があるもの全て"です。
  • PHP: 定数 - Manual

    定数 目次構文自動的に定義される定数マジック定数 定数は、値のためのID(名前)です。この名前が示すように、定数の値は スクリプト実行中に変更できません (マジック定数 は例外です。これは実際は定数ではありません)。 定数は大文字小文字を区別します。慣習的に、 定数は常に大文字で表記されます。 注意: PHP 8.0.0 より前のバージョンでは、 define() 関数を使って定義された定数は、 大文字小文字を区別しない場合がありました。 定数の名前は、PHP のラベルと同じ規則に従います。有効な定数の名前は、 文字またはアンダースコアで始まり、任意の数の文字、数字、 アンダースコアが後に続きます。正規表現で示すと次のようになります。 ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$ define() 関数を使うと、 予約語や有効でない名前の定数を定義す

    PHP: 定数 - Manual
    Itisango
    Itisango 2023/08/10
    定数は、値のためのID(名前)です。この名前が示すように、定数の値は スクリプト実行中に変更できません (マジック定数 は例外です。これは実際は定数ではありません)。 定数は大文字小文字を区別します
  • Laravel - The PHP Framework For Web Artisans

    Join us in Dallas, TX! Tickets are now available for Laracon US.

    Laravel - The PHP Framework For Web Artisans