« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 28 for trait (0.001 sec.)
トレイト | PHP 8.3 12781
トレイト PHP は、コードを再利用するための「トレイト」という仕組みを実装しています。 トレイトは、PHP のような単一継承言語でコードを再利用するための仕組みのひとつです。 トレイトは、単一継承の制約を減らすために作られたもので、 いくつかのメソッ ... 平方向で構成できるようになります。 つまり、継承しなくてもクラスのメンバーに追加できるようになります。 例1 トレイトの例 <?php trait TraitA { public function sayHello () { echo 'Hello' ; } } trait TraitB { public function sayWorld () { echo 'World' ; } } ... class MyHelloWorld { use TraitA , TraitB ; // A class can use multiple traits public function sayHelloWorld () { $this -> sayHello (); echo ' ' ; $this - ... ド、 そしてその次にくるのが継承したメソッドとなります。 <?php class Base { public function sayHello () { echo 'Hello ' ; } } trait SayWorld { public function sayHello () { parent :: sayHello (); echo 'World!' ; } } class MyHelloWorld extends Base { use ...
https://man.mtool.work/php/8.3/language.oop5.traits.html
Componere\Abstract\Definition::addTrait — Add Trait | PHP 8.3 12650
Componere\Abstract\Definition::addTrait (Componere 2 >= 2.1.0) Componere\Abstract\Definition::addTrait — Add Trait 説明 public function Componere\Abstract\Definition::addTrait ( string $trait ): Definition Shall use the given trait for the ... current definition パラメータ trait The case insensitive name of a trait 戻り値 The current Definition Exceptions 警告 Shall throw RuntimeException if Definit ...
https://man.mtool.work/php/8.3/componere-abstract-definition.addtrait.html
trait_exists — トレイトが存在するかどうかを調べる | PHP 8.3 12076
trait_exists (PHP 5 >= 5.4.0, PHP 7, PHP 8) trait_exists — トレイトが存在するかどうかを調べる 説明 function trait_exists ( string $trait , bool $autoload = true ): bool パラメータ trait 調べたいトレイトの名前。 autoload まだロードされていな ...
https://man.mtool.work/php/8.3/function.trait-exists.html
定義済み定数 | PHP 8.3 9848
定義済み定数 以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。 The following opcodes are defined as constants by uopz before 5.0.0: ZEND_EXI ... CLASS ( int ) Invoked upon composure, receives the class the name of the class being fetched as the only argument ZEND_ADD_TRAIT ( int ) Invoked upon composure, receives the class the trait is being added to as the first argument, and the name of the ... ss entry. Removed as of uopz 5.0.0. ZEND_ACC_INTERFACE ( int ) Mark class as interface. Removed as of uopz 5.0.0. ZEND_ACC_TRAIT ( int ) Mark class as trait. Removed as of uopz 5.0.0. ZEND_ACC_FETCH ( int ) Used for getting flags only. Removed as of u ...
https://man.mtool.work/php/8.3/uopz.constants.html
class_uses — 指定したクラスが使っているトレイトを返す | PHP 8.3 8848
class_uses (PHP 5 >= 5.4.0, PHP 7, PHP 8) class_uses — 指定したクラスが使っているトレイトを返す 説明 function class_uses ( object | string $object_or_class , bool $autoload = true ): array | false この関数は、指定した object_or_class が使っ ... かどうか。 戻り値 成功した場合に配列、 指定されたクラスが存在しない場合に false を返します。 例 例1 class_uses() の例 <?php trait foo { } class bar { use foo ; } print_r ( class_uses (new bar )); print_r ( class_uses ( 'bar' )); spl_autoload_register ( ... aded' , true )); ?> 上の例の出力は、 たとえば以下のようになります。 Array ( [foo] => foo ) Array ( [foo] => foo ) Array ( [trait_of_not_loaded] => trait_of_not_loaded ) 参考 class_parents() - 与えられたクラスの親クラスを返す get_declared_traits() - 宣 ...
https://man.mtool.work/php/8.3/function.class-uses.html
The Componere\Abstract\Definition class | PHP 8.3 8783
The Componere\Abstract\Definition class (Componere 2 >= 2.1.0) はじめに This final abstract represents a class entry, and should not be used by the programmer. クラス概要 final abstract class Componere\Abstract\Definition { /* メソッド */ p ... terface ): Definition public function addMethod ( string $name , Componere\Method $method ): Definition public function addTrait ( string $trait ): Definition public function getReflector (): ReflectionClass } 目次 Componere\Abstract\Definition::addIn ... terface — Add Interface Componere\Abstract\Definition::addMethod — Add Method Componere\Abstract\Definition::addTrait — Add Trait Componere\Abstract\Definition::getReflector — Reflection 他のマニュアルの関連ページ Linux JM standards(7) ...
https://man.mtool.work/php/8.3/class.componere-abstract-definition.html
uopz_compose — Compose a class | PHP 8.3 8209
uopz_compose (PECL uopz 1, PECL uopz 2) uopz_compose — Compose a class 警告 この関数は、PECL uopz 5.0.0 で 削除 されました。 説明 function uopz_compose ( string $name , array $classes , array $methods = ? , array $properties = ? , int $flag ... , extends, or uses all of the provided classes パラメータ name A legal class name classes An array of class, interface and trait names methods An associative array of methods, values are either closures or [modifiers => closure] properties An associat ... lues are modifiers flags Entry type, by default ZEND_ACC_CLASS 戻り値 例 例1 uopz_compose() example <?php class myClass {} trait myTrait {} interface myInterface {} uopz_compose ( Composed ::class, [ myClass ::class, myTrait ::class, myInterface ::cla ... class_parents ( Composed ::class), class_implements ( Composed ::class)); ?> 上の例の出力は以下となります。 array(1) { ["myTrait"]=> string(7) "myTrait" } array(1) { ["myClass"]=> string(7) "myClass" } array(1) { ["myInterface"]=> string(11) "myInterf ...
https://man.mtool.work/php/8.3/function.uopz-compose.html
パーサートークンの一覧 | PHP 8.3 8209
パーサートークンの一覧 PHP 言語の種々の部分は、内部的に トークン で表現されています。 不正なトークンのシーケンスが含まれるコードスニペットの場合、 Parse error: syntax error, unexpected token "==", expecting "(" in script.php on line 10." の ... 型キャスト T_STRING_VARNAME ( int ) "${a 可変変数 の文字列補間 T_SWITCH ( int ) switch switch T_THROW ( int ) throw throw T_TRAIT ( int ) trait トレイト T_TRAIT_C ( int ) __TRAIT__ __TRAIT__ T_TRY ( int ) try try T_UNSET ( int ) unset() unset() T_UNSET ...
https://man.mtool.work/php/8.3/tokens.html
マジック定数 | PHP 8.3 8127
マジック定数 マジック定数は、ソースコード上の位置に関する情報に置き換えられるキーワードです。 置き換えられるのは、記述されているファイルと行、およびその箇所を囲む関数、クラス、トレイト、名前空間、プロパティフックの情報です。 「定数」という名 ... ンジンが生成した名前になります。 メソッドの呼び出し先となったクラスの名前を取得するには、 static::class を使ってください。 __TRAIT__ トレイト名。 トレイト名には、宣言された名前空間も含まれます (例 Foo\Bar )。 __METHOD__ 記述されているメソッドのクラス名と ... 例1 マジック定数の使用例 <?php namespace App ; function helper () { echo __FUNCTION__ , "\n" ; echo __METHOD__ , "\n" ; } trait Greets { public function greet () { echo __CLASS__ , "\n" ; echo __TRAIT__ , "\n" ; echo __METHOD__ , "\n" ; echo __FUNCTI ...
https://man.mtool.work/php/8.3/language.constants.magic.html
キーワードのリスト | PHP 8.3 8062
キーワードのリスト これらのキーワードは、PHP では特別な意味があります。これらのいくつかは 関数やメソッドのようなものを表し、いくつかは定数のようなものを表す、 といったようになっていますが、実際にはそうではありません。実際には、 これらは言語 ... amespace new or print private protected public readonly (PHP 8.1.0 以降) * require require_once return static switch throw trait try unset() use var while xor yield yield from * readonly は、関数名として使用できます。 コンパイル時の定数 __CLASS__ __DI ... R__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __PROPERTY__ __NAMESPACE__ __TRAIT__ 他のマニュアルの関連ページ Python keyword Linux JM dm.conf(5) Linux JM pthread_yield(3) Linux JM locale(1) Linux JM char ...
https://man.mtool.work/php/8.3/reserved.keywords.html
PREV 1 2 3 NEXT