Jump to content

Take one line from a variable ??


siddscool19

Recommended Posts

Can u please tell me the meaning of this also

while(1)

i don;t want to start a new thread thats why asking here  :)

 

PLease tell also this

$link = "<div style=\"text-align: center;\">

 

Why did we add \ in "<div style=\" I mean what does \ gives output here

The back-slash is escaping the quotes. See how the variable is opened with double-quotes (") then the div tag requires double-quotes also. If you didn't have the back-slash in front of the quote PHP would throw an error at you.

If the data is coming from a textarea tag then you can use it like so:

 

$text = $_POST['textarea'];

$explode = explode(PHP_EOL, $text); //Using PHP_EOL, which is a predefined constant for the End Of Line in different OS
foreach($explode as $lines){
echo $line . "<br>"; //Echo out each line, you can perform whatever you need on the $line
}

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.