On Tue, 18 Feb 2003 16:02:59 -0500, you wrote: >http://www.psikon.com/vartest.php >http://www.psikon.com/vartest.phps > >how can I get rid of that null character or am I forced to use sub_str in >this case?
You changed the string to be "abcd\0f" on line 8. You didn't remove the character, you set it to nothing. If you want to remove the character instead... you have to slide everything after it in the string back a place. There are lots of ways to do this. For example, $var = join("", split("e", $var)); will remove all instances of "e" from $var (I find this is the most common manipulation of this type I want to do). Joining together two string parts will also work. $var = substr($var, 0, 4) . substr($var, 5, strlen($var)); ereg_replace() also springs to mind. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php