FrankenPHP 1.0には、Symphony、Laravel、WordPressなどのネイティブサポートが含まれるほか、Caddyを搭載したプロダクショングレードのPHPサーバであり、PHPアプリのスタンドアロンで実行可能なバイナリとしてのパッケージ化が可能となっている。 さらに、PHP-FPMとNgnixを個別に実行する必要がなく、1つのサービスのみでPHPサーバを提供できるようになるとともに、PHP 8.2以降のほとんどのPHP機能拡張、およびすべてのCaddyモジュールと互換性がある。 ほかにも、アプリケーション起動してメモリに保持するワーカーモード、JavaScriptイベントとしてWebブラウザへ送信されるリアルタイムイベント、ZstandardおよびGzip圧縮、構造化されたログ、Prometheusメトリクスを使用したCaddyの監視、HTTPS・HTTP/2・HTTP
RoadRunner is a high-performance PHP application server and process manager, designed with extensibility in mind through its utilization of plugins. Developed in Go, RoadRunner operates by running your application in the form of workers, where each worker represents an individual process, ensuring isolation and independence in their operation. It is designed to be like a central processor for PHP
Livewire v3 has been released! Go check it out on livewire.laravel.com! Building modern web apps is hard. Tools like Vue and React are extremely powerful, but the complexity they add to a full-stack developer's workflow is insane. It doesn’t have to be this way... Ok, I'm listening... Say hello to Livewire. Hi Livewire! Livewire is a full-stack framework for Laravel that makes building dynamic int
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 5 >= 5.3.0, PHP 7, PHP 8) 外部の完全修飾名をエイリアスで参照したりインポートしたりする機能は、 名前空間において非常に重要なものです。 これは、Unix 系のファイルシステムでファイルやディレクトリへのシンボリックリンクを作成することに似ています。 PHP は定数、関数、クラス、インターフェイス、トレイト、列挙型(Enum)、名前空間のエイリアスやインポートをサポートしています。 エイリアス作成には use 演算子を使用します。 ここに、5 種類すべてのインポート方法の例を示します。 <?php namespace foo; use My\Full\Classname as Another; // これは use My\Full\NSname as NSname と同じです use My\Full\NSname
名前空間と動的言語機能 (PHP 5 >= 5.3.0, PHP 7, PHP 8) PHP における名前空間の実装は、PHP 自身が動的プログラミング言語であるという性質に影響を受けています。 したがって、次の例のようなコードを名前空間を使って書き直すには <?php class classname { function __construct() { echo __METHOD__,"\n"; } } function funcname() { echo __FUNCTION__,"\n"; } const constname = "global"; $a = 'classname'; $obj = new $a; // classname::__construct と表示します $b = 'funcname'; $b(); // funcname と表示します echo consta
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
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 7.2.0 で、子クラスのメソッドの引数の型の制限を除く形で、反変性が一部サポートされました。 PHP 7.4.0 以降で、共変性と反変性が完全にサポートされるようになりました。 共変性とは、子クラスのメソッドが、親クラスの戻り値よりも、より特定の、狭い型を返すことを許すことです。 一方で、反変性とは、親クラスのものよりも、より抽象的な、広い型を引数に指定することを許すものです。 型宣言は以下の場合に、より特定の、狭い型であると見なされます: union 型 から、特定の型が削除されている場合 特定の型が 交差型 に追加されている場合 クラスの型が、子クラスの型に変更されている場合 iterable が 配列 または Traversable に変更されている場合 上記と反対のことが当てはまる場合は、より抽象的な、広い型であると見なされます。 <?php abstra
オブジェクトのシリアライズ - セッション内でのオブジェクト serialize() は、 PHP で保存できるあらゆる値をバイトストリームで表した文字列を返します。 unserialize() を使うと、 この文字列から元の変数の値を取り出すことができます。 オブジェクトをシリアライズすると、オブジェクト内の変数もすべて保存されます。 オブジェクト内のメソッドは保存されません。 クラス名のみが保存されます。 オブジェクトを unserialize() するには、 そのオブジェクトのクラスが定義されている必要があります。 A クラスのオブジェクトをシリアライズしたのなら、 その文字列にはクラス A とその中のすべての変数の値が含まれています。 別のファイルでそれを復元してクラス A のオブジェクトを取り出すには、 まずそのファイル内にクラス A の定義が存在しなければなりません。 これを実
Notes on reference: A reference is not a pointer. However, an object handle IS a pointer. Example: <?php class Foo { private static $used; private $id; public function __construct() { $id = $used++; } public function __clone() { $id = $used++; } } $a = new Foo; // $a is a pointer pointing to Foo object 0 $b = $a; // $b is a pointer pointing to Foo object 0, however, $b is a copy of $a $c = &$a; //
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 bool2str($bool) { if ($bool === false) { return 'FALSE'; } else { return 'TRUE'; } } function compareObjects(&$o1, &$o2) { echo 'o1 == o2 : ' . bool2str($o1 == $o2) . "
オブジェクトのクローン作成 オブジェクトのコピーを作成する際、そのプロパティも全て二重化することが、 常に望ましい動作であるわけではありません。 コピーコンストラクタが必要となる例として、 GTKウインドウを表すオブジェクトを有しており、 そのオブジェクトがGTKウインドウのリソースを保持している際、 コピーを作成する時に、同じプロパティを有するウインドウを作成し、 その新しいオブジェクトがその新しいウインドウのリソースを保持する ようにしたい場合が考えられます。 他の例としては、 オブジェクトがそのオブジェクトが使用する他のオブジェクトへのリファレンスを 保持しており、親オブジェクトをコピーする際に、そのコピーが独立したオブジェクトの コピーを有するように、そのオブジェクトのインスタンスを新たに作成したい場合が 考えられます。 オブジェクトのコピーは、clone キーワード (これは、そ
finalキーワード キーワード final を前に付けて定義されたメソッドや定数は、子クラスから上書きできません。 クラス自体がfinalと定義された場合には、このクラスを拡張することはできません。 <?php class BaseClass { public function test() { echo "BaseClass::test() called\n"; } final public function moreTesting() { echo "BaseClass::moreTesting() called\n"; } } class ChildClass extends BaseClass { public function moreTesting() { echo "ChildClass::moreTesting() called\n"; } } // Results in
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く