downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplObjectStorage::offsetUnset> <SplObjectStorage::offsetGet
[edit] Last updated: Fri, 25 May 2012

view this page in

SplObjectStorage::offsetSet

(PHP 5 >= 5.3.0)

SplObjectStorage::offsetSetストレージ内のオブジェクトにデータを関連づける

説明

public void SplObjectStorage::offsetSet ( object $object [, mixed $data = NULL ] )

ストレージ内のオブジェクトにデータを関連づけます。

注意:

SplObjectStorage::offsetSet() は、 SplObjectStorage::attach() のエイリアスです。

パラメータ

object

データを関連づけたいオブジェクト。

data

object に関連づけるデータ。

返り値

値を返しません。

例1 SplObjectStorage::offsetSet() の例

<?php
$s 
= new SplObjectStorage;

$o1 = new StdClass;

$s->offsetSet($o1"hello"); // $s[$o1] = "hello"; と同等

var_dump($s[$o1]);
?>

上の例の出力は、 たとえば以下のようになります。

string(5) "hello"

参考



add a note add a note User Contributed Notes SplObjectStorage::offsetSet
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites