the easiest way would be:
?
// -
// init var
$str = ;
$str = abc def ghi;
$str = str_replace ( , , $str);
echo $str.br;
//
// output:
// abcdefghi
//
//
// or a regex:
$str = abc def ghi;
$str = ereg_replace( , , $str);
Say I have a string xyz abc def and I want to remove all of the spaces
withing the string to create a new one. What's the best way?
?
$string = xyz abc def;
$stringWithOutSpaces = implode( , explode( , $string ));
?
Or you can use eregi_replace(), but I don't know what the regex would
?php
$old = xyz abc def;
$newstr = ereg_replace( ,,$old);
?
-Original Message-
From: Chuck Barnett [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 03, 2002 2:01 PM
To: PHP General List
Subject: [PHP] strip spaces from inside string
Say I have a string xyz abc def and I want to
3 matches
Mail list logo