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

search for in the

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

view this page in

SplObjectStorage::offsetExists

(PHP 5 >= 5.3.0)

SplObjectStorage::offsetExistsオブジェクトがストレージ内に存在するかどうかを調べる

説明

public bool SplObjectStorage::offsetExists ( object $object )

オブジェクトがストレージ内に存在するかどうかを調べます。

パラメータ

object

探したいオブジェクト。

返り値

object がストレージ内に存在する場合に TRUE、 それ以外の場合に FALSE を返します。

例1 SplObjectStorage::offsetExists() の例

<?php
$s 
= new SplObjectStorage;
$o1 = new StdClass;
$o2 = new StdClass;

$s->attach($o1);

var_dump($s->offsetExists($o1)); // isset($s[$o1]) と同等
var_dump($s->offsetExists($o2)); // isset($s[$o2]) と同等
?>

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

bool(true)
bool(false)

参考



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

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