1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Files
archived-php-src/ext/simplexml/tests/014.phpt
T
2003-12-18 13:35:39 +00:00

42 lines
897 B
PHP

--TEST--
SimpleXML: adding/removing attributes
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml =<<<EOF
<people>
<person name="Joe"></person>
<person name="Boe"></person>
</people>
EOF;
$people = simplexml_load_string($xml);
var_dump($people->person[0]['name']);
var_dump($people->person[0]['age']);
$person = $people->person[0];
$person['name'] = "XXX";
var_dump($people->person[0]['name']);
$people->person[0]['age'] = 30;
var_dump($people->person[0]['age']);
$people->person[0]['age'] += 5;
var_dump($people->person[0]['age']);
echo "---Unset:---\n";
unset($people->person[0]['age']);
echo "---Unset?---\n";
var_dump($people->person[0]['age']);
var_dump(isset($people->person[0]['age']));
echo "---Done---\n";
?>
--EXPECT--
string(3) "Joe"
NULL
string(3) "XXX"
string(2) "30"
string(2) "35"
---Unset:---
---Unset?---
NULL
bool(false)
---Done---