Jump to content

[SOLVED] Fopen And Making Breaks


phpSensei

Recommended Posts

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>

 

Link to comment
https://forums.phpfreaks.com/topic/64948-solved-fopen-and-making-breaks/
Share on other sites

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.