Re: Variable problem
| From: | Stephen Edmonds | Date: | Mon, 18 Nov 2002 16:56:15 +0000 |
| Subject: | Re: Variable problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-17014@lists.php.net to get a copy of this message | ||
If you need to remove the space, use trim( $variable ). Trim() removes all
white space/tabs etc from the end and start of a string.
$Variable = " LOTS of white Space :-( ";
trim( $Variable );
echo "*".$Variable."*";
displays
*LOTS of white Space :-(*
instead of
* LOTS of white Space :-( *
which would occur without the use of trim
chop() does the same but ONLY at the end of a string. (IE: Space at the
start is kept)
$Variable = " LOTS of white Space :-( ";
chop( $Variable );
echo "*".$Variable."*";
displays
* LOTS of white Space :-(*
ltrim() does the same but ONLY at the start of a string (IE: Space at the
end is kept)
$Variable = " LOTS of white Space :-( ";
ltrim( $Variable );
echo "*".$Variable."*";
displays
*LOTS of white Space :-( *
Hope this helps
Stephen
----- Original Message -----
From: "suhailkaleem" <suhailkaleem@pakidost.com>
To: <php-windows@lists.php.net>
Sent: Monday, November 18, 2002 1:05 PM
Subject: [PHP-WIN] Variable problem
> hi !
>
> yes you were right there is space between server name but still i am
unable
> to remove it
>
>
> $username ,$password,$server are comming from file and they have correct
> values
>
> $username1 = $username;
> $password1 = $password;
> $server1 = $server;
> echo $server."test<BR>" ;
> echo $password."test<BR>" ;
> echo $username."test<BR>" ;
>
> /*
> This echo
> 127.0.0.1 test
> excel test
> suhailkaleem test
>
> it echo with a space between variable value and the string test .there
> is space in text file at the end of these values ?
>
>
> */
>
>
>
> $username = "suhailkaleem";
> $password = "excel";
> $server = "127.0.0.1";
> echo $server."test" ;
> // This echo 127.0.0.1test no space
>
>
>
>
> /*
> why is that i see space between server and string when the values come
from
> the text file , although there is no space in text file at the end of
> server name but when i use in my script the space appears?????
> */
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>