Jump to content

Recommended Posts

Hi, I was wondering if someone could help me, i don't understand how to format

<?php
$xmlfile = fopen("squad.xml", "w");
[color=red]fwrite($xmlfile,"<?xml version="1.0"?>"); [/color]
fclose($xmlfile);
?>

That line, i understand its the "" that will be causing the problem? or it could be something else like the <>??? how could i format this line in fwrite so it can be writen like that into the file but also php-friendly.

Many thanks!!!
Or you could use single quotes to delimit the string, then you don't have to escape the double quotes:
[code]<?php
$xmlfile = fopen("squad.xml", "w");
fwrite($xmlfile,'<?xml version="1.0"?>');
fclose($xmlfile);
?>[/code]

Ken
[quote author=kenrbnsn link=topic=124407.msg515420#msg515420 date=1169998350]
Or you could use single quotes to delimit the string, then you don't have to escape the double quotes
[/quote]

Matty,

What Ken said is very true, and probably in this situation the better way to go.  Having said that, it is important you know how to escape special characters within strings.

Regards
Huggie
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.