Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

libxml_set_external_entity_loader(3) [php man page]

LIBXML_SET_EXTERNAL_ENTITY_LOADER(3)					 1				      LIBXML_SET_EXTERNAL_ENTITY_LOADER(3)

libxml_set_external_entity_loader - Changes the default external entity loader

SYNOPSIS
void libxml_set_external_entity_loader (callable $resolver_function) DESCRIPTION
Changes the default external entity loader. PARAMETERS
o $resolver_function - A callable that takes three arguments. Two strings, a public id and system id, and a context (an array with four keys) as the third argument. This callback should return a resource, a string from which a resource can be opened, or NULL. RETURN VALUES
No value is returned. EXAMPLES
Example #1 libxml_set_external_entity_loader(3) example <?php $xml = <<<XML <!DOCTYPE foo PUBLIC "-//FOO/BAR" "http://example.com/foobar"> <foo>bar</foo> XML; $dtd = <<<DTD <!ELEMENT foo (#PCDATA)> DTD; libxml_set_external_entity_loader( function ($public, $system, $context) use($dtd) { var_dump($public); var_dump($system); var_dump($context); $f = fopen("php://temp", "r+"); fwrite($f, $dtd); rewind($f); return $f; } ); $dd = new DOMDocument; $r = $dd->loadXML($xml); var_dump($dd->validate()); ?> The above example will output: string(10) "-//FOO/BAR" string(25) "http://example.com/foobar" array(4) { ["directory"] => NULL ["intSubName"] => NULL ["extSubURI"] => NULL ["extSubSystem"] => NULL } bool(true) SEE ALSO
libxml_disable_entity_loader(3). PHP Documentation Group LIBXML_SET_EXTERNAL_ENTITY_LOADER(3)

Check Out this Related Man Page

SPLOBJECTSTORAGE(3)							 1						       SPLOBJECTSTORAGE(3)

The SplObjectStorage class

INTRODUCTION
The SplObjectStorage class provides a map from objects to data or, by ignoring data, an object set. This dual purpose can be useful in many cases involving the need to uniquely identify objects. CLASS SYNOPSIS
SplObjectStorage SplObjectStorageCountableIteratorSerializableArrayAccess Methods o public void SplObjectStorage::addAll (SplObjectStorage $storage) o public void SplObjectStorage::attach NULL (object $object, [mixed $data]) o public bool SplObjectStorage::contains (object $object) o public int SplObjectStorage::count (void ) o public object SplObjectStorage::current (void ) o public void SplObjectStorage::detach (object $object) o public string SplObjectStorage::getHash (object $object) o public mixed SplObjectStorage::getInfo (void ) o public int SplObjectStorage::key (void ) o public void SplObjectStorage::next (void ) o public bool SplObjectStorage::offsetExists (object $object) o public mixed SplObjectStorage::offsetGet (object $object) o public void SplObjectStorage::offsetSet NULL (object $object, [mixed $data]) o public void SplObjectStorage::offsetUnset (object $object) o public void SplObjectStorage::removeAll (SplObjectStorage $storage) o public void SplObjectStorage::removeAllExcept (SplObjectStorage $storage) o public void SplObjectStorage::rewind (void ) o public string SplObjectStorage::serialize (void ) o public void SplObjectStorage::setInfo (mixed $data) o public void SplObjectStorage::unserialize (string $serialized) o public bool SplObjectStorage::valid (void ) EXAMPLES
Example #1 SplObjectStorage as a set <?php // As an object set $s = new SplObjectStorage(); $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $s->attach($o1); $s->attach($o2); var_dump($s->contains($o1)); var_dump($s->contains($o2)); var_dump($s->contains($o3)); $s->detach($o2); var_dump($s->contains($o1)); var_dump($s->contains($o2)); var_dump($s->contains($o3)); ?> The above example will output: bool(true) bool(true) bool(false) bool(true) bool(false) bool(false) Example #2 SplObjectStorage as a map <?php // As a map from objects to data $s = new SplObjectStorage(); $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $s[$o1] = "data for object 1"; $s[$o2] = array(1,2,3); if (isset($s[$o2])) { var_dump($s[$o2]); } ?> The above example will output: array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } PHP Documentation Group SPLOBJECTSTORAGE(3)
Man Page