Jump to content

$row detecting line break a setting to a variable


morrisjohnny

Recommended Posts

Right i can use $row['upgrades']; correctlyi can also detect line breaks and replace it with <br /> so it gives a line break on the pagebut my question is is their a way i can detect a line break and give the text before the line break a value? and after the line break?egavailable upgradesbetter powercheaper to runquickerso that $vai1="better power";$vai1="cheaper to run";$vai1="quicker"; if you get me please ask if you are unsure?cheers-jny

Link to comment
Share on other sites

I haven't tested this yet (or I think I haven't, maybe I did but it was a long time ago and I don't remember the result) but I think it should work:$string = "This is some textwith a line break";$var = explode("\n",$string);/*Output:$var[1] => "This is some text"$var[2] => "with a line break"*/

Link to comment
Share on other sites

SORTEDAnswer

while(isset($var[$value]))	{	echo $var[$value];	$value++;	}?>

Old Questionsnext question

$string = "This is some textwith a line break";$var = explode("\n",$string);$value="0";while(isset($var['$value']))	{	echo "Text = ".$var['$value'];	$value++;	}

why is that not working? something to do with two variables?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...