Link to home
Start Free TrialLog in
Avatar of newbe101
newbe101

asked on

easy php print character

I am using php to write a php file.  How would I fwrite a \' together without my php thinking I only want a '
I tried \\' but I don't think it is right... let me know if I am wrong.
SOLUTION
Avatar of tg_wilk
tg_wilk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of newbe101
newbe101

ASKER

I know, but how would I fwrite a \' to a php file for use in the new file?  I don't need the fwrite part, just the characters to print \' in a php file that will be using the \'
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Lets say you want a file like this
 
<?php
$character = '\'';
?>
 
So you can fwrite
 
<?php
$content = <<<THEEND
<?php
$character = '\'';
?>
THEEND;
fwrite($file,$content);
?>
 
or if you want to stick with the single quotes:
 
<?php
$content = '<?php
$character = \'\\\'\';
?>';
fwrite($file,$content);
?>
 
Is that what you're looking for?

Open in new window

cxr got it for me... thanks both of you.