str_replace not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chopficaro
Forum Commoner
Posts: 68
Joined: Fri Jan 01, 2010 12:56 am

str_replace not working

Post by chopficaro »

trying to truncate the spaces and \n's on this ****ing string and they wont go away

Code: Select all

	for($j=0;$j<$count;$j++)
	{
		$fieces = explode(" ", $pieces[$j], 2);
		echo $fieces[1];
		$string = str_replace("\n", "", $fieces[1]);
		echo $string;
		$string2 = str_replace(" ", "", $string);
		echo $string2;
		$dbmember[$j]=$string2;
		echo "debug ".$pieces[$j].", ".$dbmember[$j]."<br/>";
		for($k=0;$k<$i;$k++)
		{
			if($dbmember[$j]==$name[$k])
			{
				echo "match at ".$k.": ".$dbmember[$j].", ".$name[$k]."<br/>";
				if($check[$j]==0)
				{
					$check[$j]=1;
				}
				else
				{
					die("you have entered the same rank twice");
				}
			}
			else
			{
				echo "no match :".$dbmember[$j].", ".$name[$k]."<br/>";
			}

		}
	}
chopficaro
Forum Commoner
Posts: 68
Joined: Fri Jan 01, 2010 12:56 am

Re: str_replace not working

Post by chopficaro »

no matter what i do theres still a /n at the end
chopficaro
Forum Commoner
Posts: 68
Joined: Fri Jan 01, 2010 12:56 am

Re: str_replace not working

Post by chopficaro »

nm it was just M$ ading their own handy \r newline to everything
god bless M$ and all their time saving features
Post Reply