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
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?

Link to comment
Share on other sites

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.