Results of 1 - 1 of about 1 for showStuff (0.000 sec.)
- Stringable インターフェイス | PHP 8.3 9414
- Stringable インターフェイス (PHP 8) はじめに Stringable インターフェイスは、 特定のクラスが __toString() メソッドを実装していることを示します。 ほとんどのインターフェイスと異なり、 Stringable は、マジックメソッド __toString() が定義されてい
... c function __toString (): string { return " $this -> oct1 . $this -> oct2 . $this -> oct3 . $this -> oct4 " ; } } function showStuff ( string | Stringable $value ) { // Stringable を渡した場合、以下は暗黙のうちに __toString() をコールします。 print $value ... ; } $ip = new IPv4Address ( '123' , '234' , '42' , '9' ); showStuff ( $ip ); ?> 上の例の出力は、 たとえば以下のようになります。 123.234.42.9 目次 Stringable::__toString — オブジェクトの文字列 ...
-
https://man.mtool.work/php/8.3/class.stringable.html
PREV
1
NEXT