Re: [PHP] function into string
On Tue, Aug 07, 2001 at 02:30:31PM +0200, Veniamin Goldin wrote: > Sorry for the dummies question, but how do I insert into string like: > > echo "balalala" > > how to insert function in the midle like : > echo "balalala [trim(odbc_result($result_id,3))] aasasasas" > > > Thank you. > How about: echo "balalala ".trim(odbc_result($result_id,3))." aasasasas"; or echo "balalala [".trim(odbc_result($result_id,3))."] aasasasas"; depending on what you meant by the '[' and ']'. This is just one of many possible ways of doing it. I, myself, am not to happy with echo(). Don't ask me why, just a feeling... No return value and stuff. I prefer using real functions that I can check on being successful. So how about: print ("balalala [".trim(odbc_result($result_id,3))."] aasasasas"); or printf ("balalala [%s] aasasasas", trim(odbc_result($result_id,3))); Well... as I said, many possibilities... -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] function into string
Try readin the manual before posting.. all you want is the string concatenation operator . PHP is weakly typed so no direct conversion is needed echo "balalala " . trim(odbc_result($result_id,3)) . " aasasasas" > Sorry for the dummies question, but how do I insert into string like: > > echo "balalala" > > how to insert function in the midle like : > echo "balalala [trim(odbc_result($result_id,3))] aasasasas" > > > Thank you. > > > - Original Message - > > From: "René Moonen" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, August 07, 2001 2:02 PM > > Subject: [Re: [PHP] user's ip] > > > > > > > The problem is that REMOTE_ADDR returns the IP address of the proxy (if > > > the user > > > accesses the web-page via a proxy. This will allways return the IP > > > address of > > > the user's machine: > > > > > > if(getenv(HTTP_X_FORWARDED_FOR)) > > > { > > > $ip=getenv(HTTP_X_FORWARDED_FOR); > > > } > > > else > > > { > > > $ip=getenv(REMOTE_ADDR); > > > } > > > $host = gethostbyaddr($ip); > > > > > > > > > Renze Munnik wrote: > > > > > > > On Tue, Aug 07, 2001 at 03:55:25PM +0530, Adrian D'Costa wrote: > > > > > Hi, > > > > > > > > > > I am trying to get the ip address of any user browsing a particular > > page. > > > > > > > > > > I tried $REMOTE_ADDR but that give me only the remote address. What > > would > > > > > be the best way? > > > > > > > > > > Adrian > > > > > > > > Okay... Help me out here... > > > > You want to know someones IP-address and using $REMOTE_ADDR you get > > > > the IP-address of the user. What's the problem man?!?!?! > > > > > > > > -- > > > > > > > > * R&zE: > > > > > > > > -- > > > > -- Renze Munnik > > > > -- DataLink BV > > > > -- > > > > -- E: [EMAIL PROTECTED] > > > > -- W: +31 23 5326162 > > > > -- F: +31 23 5322144 > > > > -- M: +31 6 21811143 > > > > -- H: +31 23 5516190 > > > > -- > > > > -- Stationsplein 82 > > > > -- 2011 LM HAARLEM > > > > -- > > > > -- http://www.datalink.nl > > > > -- > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] function into string
Sorry for the dummies question, but how do I insert into string like: echo "balalala" how to insert function in the midle like : echo "balalala [trim(odbc_result($result_id,3))] aasasasas" Thank you. > - Original Message - > From: "René Moonen" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, August 07, 2001 2:02 PM > Subject: [Re: [PHP] user's ip] > > > > The problem is that REMOTE_ADDR returns the IP address of the proxy (if > > the user > > accesses the web-page via a proxy. This will allways return the IP > > address of > > the user's machine: > > > > if(getenv(HTTP_X_FORWARDED_FOR)) > > { > > $ip=getenv(HTTP_X_FORWARDED_FOR); > > } > > else > > { > > $ip=getenv(REMOTE_ADDR); > > } > > $host = gethostbyaddr($ip); > > > > > > Renze Munnik wrote: > > > > > On Tue, Aug 07, 2001 at 03:55:25PM +0530, Adrian D'Costa wrote: > > > > Hi, > > > > > > > > I am trying to get the ip address of any user browsing a particular > page. > > > > > > > > I tried $REMOTE_ADDR but that give me only the remote address. What > would > > > > be the best way? > > > > > > > > Adrian > > > > > > Okay... Help me out here... > > > You want to know someones IP-address and using $REMOTE_ADDR you get > > > the IP-address of the user. What's the problem man?!?!?! > > > > > > -- > > > > > > * R&zE: > > > > > > -- > > > -- Renze Munnik > > > -- DataLink BV > > > -- > > > -- E: [EMAIL PROTECTED] > > > -- W: +31 23 5326162 > > > -- F: +31 23 5322144 > > > -- M: +31 6 21811143 > > > -- H: +31 23 5516190 > > > -- > > > -- Stationsplein 82 > > > -- 2011 LM HAARLEM > > > -- > > > -- http://www.datalink.nl > > > -- > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]