Results of 1 - 10 of about 147 for stdClass (0.004 sec.)
- Serialization and deserialization of PHP variables into MongoDB | PHP 8.3 11133
- Serialization and deserialization of PHP variables into MongoDB This document discusses how compound structures (i.e. documents, arrays, and objects) are converted between BSON and PHP values. Serialization to BSON Arrays If an array is a p
... e examples are extracts of a full document, and represent only one value inside a document. Objects If an object is of the stdClass class, serialize as a BSON document . If an object is a supported class that implements MongoDB\BSON\Type , then use the B ... nts the MongoDB\BSON\Serializable interface, call MongoDB\BSON\Serializable::bsonSerialize() and use the returned array or stdClass to serialize as a BSON document or array. The BSON type will be determined by the following: Root documents must be serial ... rns a packed array, serialize as a BSON array. If MongoDB\BSON\Serializable::bsonSerialize() returns a non-packed array or stdClass , serialize as a BSON document. If MongoDB\BSON\Serializable::bsonSerialize() did not return an array or stdClass , throw ...
-
https://man.mtool.work/php/8.3/mongodb.persistence.html
- stdClass クラス | PHP 8.3 10827
- stdClass クラス (PHP 4, PHP 5, PHP 7, PHP 8) はじめに 動的なプロパティが使える、汎用的な空のクラスです。 このクラスのインスタンスは、 new 演算子や、 オブジェクトへの型変換 によって作成できます。 PHP の関数によっては、このクラスのインスタンス
... は必要ありません。 PHP には全てのクラスの親となる基底クラスの概念がないため、 このクラスは基底クラスではありません。 ただ、 stdClass を継承させることで、 動的なプロパティの機能を持ったカスタムクラスを結果的に作ることはできます。 クラス概要 #[ \AllowDynami ... cProperties ] class stdClass { } このクラスは、メソッドやデフォルトのプロパティを持っていません。 例 例1 オブジェクトへの型変換を使い、stdClass を作る ... <?php $obj = (object) array( 'foo' => 'bar' ); var_dump ( $obj ); 上の例の出力は以下となります。 object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" } 例2 json_decode() によって、stdClass を作る <?php $json = '{"foo":"bar"}' ; var_dump ...
-
https://man.mtool.work/php/8.3/class.stdclass.html
- Threaded::merge — Manipulation | PHP 8.3 9722
- Threaded::merge (PECL pthreads >= 2.0.0) Threaded::merge — Manipulation 説明 public function Threaded::merge ( mixed $from , bool $overwrite = ? ): bool Merges data into the current object パラメータ from The data to merge overwrite Overwri
... the property table of a threaded object <?php $array = []; while ( count ( $array ) < 10 ) $array [] = count ( $array ); $stdClass = new stdClass (); $stdClass -> foo = "foo" ; $stdClass -> bar = "bar" ; $stdClass -> baz = "baz" ; $safe = new Threaded ( ... ); $safe -> merge ( $array ); $safe -> foo = "bar" ; $safe -> merge ( $stdClass , false ); var_dump ( $safe ); ?> 上の例の出力は以下となります。 object(Threaded)#2 (13) { ["0"]=> int(0) ["1"]=> int(1) [ ...
-
https://man.mtool.work/php/8.3/threaded.merge.html
- MongoDB\Driver\ReadPreference::bsonSerialize — Returns an object for BSON seria... 9405
- MongoDB\Driver\ReadPreference::bsonSerialize (mongodb >=1.2.0) MongoDB\Driver\ReadPreference::bsonSerialize — Returns an object for BSON serialization 説明 final public function MongoDB\Driver\ReadPreference::bsonSerialize (): stdClass パラ
... oDB\BSON\Document :: fromPHP ( $rp )-> toRelaxedExtendedJSON (); ?> 上の例の出力は、 たとえば以下のようになります。 object(stdClass)#2 (1) { ["mode"]=> string(7) "primary" } { "mode" : "primary" } 例2 MongoDB\Driver\ReadPreference::bsonSerialize() with s ... oDB\BSON\Document :: fromPHP ( $rp )-> toRelaxedExtendedJSON (); ?> 上の例の出力は、 たとえば以下のようになります。 object(stdClass)#2 (2) { ["mode"]=> string(9) "secondary" ["tags"]=> array(3) { [0]=> object(stdClass)#1 (1) { ["dc"]=> string(2) "ny" } [ ... 1]=> object(stdClass)#5 (2) { ["dc"]=> string(2) "sf" ["use"]=> string(9) "reporting" } [2]=> object(stdClass)#4 (0) { } } } { "mode" : "second ...
-
https://man.mtool.work/php/8.3/mongodb-driver-readpreference.bsonserialize.html
- 型演算子 | PHP 8.3 8617
- 型演算子 instanceof を使用して、 ある PHP 変数が特定の クラス のオブジェクトのインスタンスであるかどうかを調べます。 例1 クラスでの instanceof の使用法 <?php class MyClass { } class NotMyClass { } $a = new MyClass ; var_dump ( $a instanceof
... クトがクラスのインスタンスで ない かどうかを調べる方法 <?php class MyClass { } $a = new MyClass ; var_dump (!( $a instanceof stdClass )); ?> 上の例の出力は以下となります。 bool(true) 最後に、 instanceof は、ある変数が特定の インターフェイス を実装したクラス ... た。 例6 instanceof での他の変数の調べかた <?php $a = 1 ; $b = NULL ; $c = fopen ( '/tmp/' , 'r' ); var_dump ( $a instanceof stdClass ); // $a は整数です var_dump ( $b instanceof stdClass ); // $b は NULL です var_dump ( $c instanceof stdClass ); // $c はリ ... ソースです var_dump ( FALSE instanceof stdClass ); ?> 上の例の出力は以下となります。 bool(false) bool(false) bool(false) PHP Fatal error: instanceof expects an object ins ...
-
https://man.mtool.work/php/8.3/language.operators.type.html
- array_udiff — データの比較にコールバック関数を用い、配列の差を計算する | PHP 8.... 8147
- array_udiff (PHP 5, PHP 7, PHP 8) array_udiff — データの比較にコールバック関数を用い、配列の差を計算する 説明 function array_udiff ( array $array , array ...$arrays , callable $value_compare_func ): array データの比較にコールバック関数を用い
... <=> $value2 ; }; ?> 戻り値 他の引数のいずれにも存在しない array の値の全てを有する配列を返します。 例 例1 array_udiff() で stdClass オブジェクトを使う例 <?php // 比較する配列 $array1 = array(new stdClass , new stdClass , new stdClass , new stdClass , ); ... $array2 = array( new stdClass , new stdClass , ); // オブジェクトにプロパティを設定します $array1 [ 0 ]-> width = 11 ; $array1 [ 0 ]-> height = 3 ; $arr ... 0 ; } } print_r ( array_udiff ( $array1 , $array2 , 'compare_by_area' )); ?> 上の例の出力は以下となります。 Array ( [0] => stdClass Object ( [width] => 11 [height] => 3 ) [1] => stdClass Object ( [width] => 7 [height] => 1 ) ) 例2 array_udiff() で DateTi ...
-
https://man.mtool.work/php/8.3/function.array-udiff.html
- SplObjectStorage::next — 次のエントリに移動する | PHP 8.3 8065
- SplObjectStorage::next (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplObjectStorage::next — 次のエントリに移動する 説明 public function SplObjectStorage::next (): void イテレータを、ストレージ内の次のオブジェクトに移動します。 パラメータ この関数にはパラ
... タはありません。 戻り値 値を返しません。 例 例1 SplObjectStorage::next() の例 <?php $s = new SplObjectStorage (); $o1 = new stdClass ; $o2 = new stdClass ; $s -> attach ( $o1 , "d1" ); $s -> attach ( $o2 , "d2" ); $s -> rewind (); while( $s -> valid ()) { ... r_dump ( $index ); var_dump ( $object ); $s -> next (); } ?> 上の例の出力は、 たとえば以下のようになります。 int(0) object(stdClass)#2 (0) { } int(1) object(stdClass)#3 (0) { } 参考 SPLObjectStorage::rewind() - イテレータをストレージの最初の要素に巻き戻す ...
-
https://man.mtool.work/php/8.3/splobjectstorage.next.html
- MongoDB\BSON\Persistable::bsonSerialize — Provides an array or document to seri... 7982
- MongoDB\BSON\Persistable::bsonSerialize (mongodb >=1.0.0) MongoDB\BSON\Persistable::bsonSerialize — Provides an array or document to serialize as BSON 説明 abstract public function MongoDB\BSON\Persistable::bsonSerialize (): array | stdClass
... s | MongoDB\BSON\Document Called during serialization of the object to BSON. The method must return an array , stdClass , or MongoDB\BSON\Document . The return value will always be serialized as a BSON document. The serialized document will i ... \ObjectId for insert or upsert operations, respectively. パラメータ この関数にはパラメータはありません。 戻り値 An array , stdClass , or MongoDB\BSON\Document to be serialized as a BSON document. 変更履歴 バージョン 説明 PECL mongodb 2.0.0 Return types p ... now enforced. PECL mongodb 1.17.0 This method may now also return MongoDB\BSON\Document instances in addition to array and stdClass . 参考 MongoDB\BSON\Serializable::bsonSerialize() - Provides an array or document to serialize as BSON MongoDB\BSON\Unseri ...
-
https://man.mtool.work/php/8.3/mongodb-bson-persistable.bsonserialize.html
- var_export — 変数の文字列表現を出力または返す | PHP 8.3 7912
- var_export (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) var_export — 変数の文字列表現を出力または返す 説明 function var_export ( mixed $value , bool $return = false ): ? string var_export() は、 渡された変数に関する構造化された情報を返します。この
... 場合、そのクラス名は完全修飾名になりました。 これより前のバージョンでは、先頭のバックスラッシュが省略されていました。 7.3.0 stdClass オブジェクトは、 存在しないメソッド stdClass::__setState() を使わず、 配列をオブジェクトにキャストした形 ( (object) array( ... ... ) ) でエクスポートされるようになりました。 この変更によって、 stdClass がエクスポート可能になり、 このバージョンより前の PHP でもエクスポートした結果が動くようになりました。 例 例1 var_export() ... ), ) <?php $b = 3.1 ; $v = var_export ( $b , true ); echo $v ; ?> 上の例の出力は以下となります。 3.1 例2 PHP 7.3.0 以降で stdClass をエクスポートする <?php $person = new stdClass ; $person -> name = 'ElePHPant ElePHPantsdotter' ; $person -> website = 'h ...
-
https://man.mtool.work/php/8.3/function.var-export.html
- SplObjectStorage::rewind — イテレータをストレージの最初の要素に巻き戻す | PHP 8... 7912
- SplObjectStorage::rewind (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplObjectStorage::rewind — イテレータをストレージの最初の要素に巻き戻す 説明 public function SplObjectStorage::rewind (): void イテレータをストレージの最初の要素に巻き戻します。 パラメ
... はありません。 戻り値 値を返しません。 例 例1 SplObjectStorage::rewind() の例 <?php $s = new SplObjectStorage (); $o1 = new stdClass ; $o2 = new stdClass ; $s -> attach ( $o1 , "d1" ); $s -> attach ( $o2 , "d2" ); $s -> rewind (); while( $s -> valid ()) { ... o (); var_dump ( $object ); var_dump ( $data ); $s -> next (); } ?> 上の例の出力は、 たとえば以下のようになります。 object(stdClass)#2 (0) { } string(2) "d1" object(stdClass)#3 (0) { } string(2) "d2" 参考 SplObjectStorage::next() - 次のエントリに移動する ...
-
https://man.mtool.work/php/8.3/splobjectstorage.rewind.html