phpSensei Posted August 14, 2007 Share Posted August 14, 2007 Every I want to write into a file and I put a "<"br">" it prints out "<"br">" instead of a break... <?php $myFile = "connect.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "<?php<br>"; fwrite($fh, $stringData); fclose($fh); ?> PRINTS OUT: <?php<br> Quote Link to comment Share on other sites More sharing options...
trq Posted August 14, 2007 Share Posted August 14, 2007 The code you have provided shouldn't print out anything. Be specific with your problems. What exactly do you want to do? Quote Link to comment Share on other sites More sharing options...
trq Posted August 14, 2007 Share Posted August 14, 2007 I think I understand you question a little more now. The.... <br> tag is a html tag. If you want to write <?php followed by a new line into a file use... $stringData = "<?php\n"; Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 14, 2007 Share Posted August 14, 2007 If ure intending to write php code to that file u can write it like: $stringData = "<?php echo '<br />'?>"; // or \n it doesnt matter Quote Link to comment Share on other sites More sharing options...
SirChick Posted August 14, 2007 Share Posted August 14, 2007 waht ever you put in the " " be stored as a string! cos your telling it that stringdata = that string in the "symbols" if u had: $stringData = "cheeeeeeeeeeeese"; the cheese becomes nothing more than a string (variable). You cannot put php string as a variable assignment and run it like that. What i mean is you cannot do this: $include = "Include (login.php);" it won't read it as an include itll read it as "Include (login.php)" string. Which possible could then just be ran by doing: $include but why you would do that seems a bit pointless. do you have something like: echo $stringData or print $stringData in your code some where? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.