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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
>
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to