morrisjohnny Posted November 19, 2007 Share Posted November 19, 2007 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 More sharing options...
Ingolme Posted November 19, 2007 Share Posted November 19, 2007 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 More sharing options...
morrisjohnny Posted November 19, 2007 Author Share Posted November 19, 2007 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 More sharing options...
Ingolme Posted November 19, 2007 Share Posted November 19, 2007 Try removing the quotes from these:$value="0"; -----> $value = 0;$var['$value'] -----> $var[$value]It's a number type of data and doesn't need quotes. Link to comment Share on other sites More sharing options...
morrisjohnny Posted November 19, 2007 Author Share Posted November 19, 2007 Cheers worked :-)Thank u so mch Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.