Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$set_of_books = array
(
[1] => array
(
[title] => 'PHP and MySQL for Dummies',
[authors] => array
(
[name] => 'Janet Valade'
)
[bookinfo] => array
(
[binding] => 'paperback',
[pages] => 408,
[publisher] => 'John Wiley and Sons'
)
),
[2] => array
(
[title] => 'the Internet for Dummies',
[authors] => array
(
[name] => 'John R. Levine',
[name] => 'Carol Baroudi',
[name] => 'Margaret Levine-Young'
)
[bookinfo] => array
(
[binding] => 'paperback',
[pages] => 360,
[publisher] => 'John Wiley and Sons'
)
)
)
$xmlcontents = "<?xml version=\"1.0\"?>
<everything>
<title>title</title>
<author>author</author>
<review>
blablabla
yeah yeah yeah
whatever =)
</review>
</everything>";
$fp=fopen($filename,"w");
fwrite($fp,$writetofile);
fclose($fp);
function untag($string,$tag,$mode){
$tmpval="";
$preg="/<".$tag.">(.*?)<\/".$tag.">/si";
preg_match_all($preg,$string,$tags);
foreach ($tags[1] as $tmpcont){
if ($mode==1){$tmpval[]=$tmpcont;}
else {$tmpval.=$tmpcont;}
}
return $tmpval;
}
$xmlfile = fopen($filename,"r");
$xmlfilecontents = fread($xmlfile, filesize($filename));
fclose($xmlfile);
$xmldata = untag($xmlfilecontents,"everything",0);
$title = untag($xmlfile,"title",0);
$author = untag($xmlfile,"author",0);
MakeUniverse($infinity,1,42);