[PHP-DB] Re: Function Name available within function?
Yes - __FUNCTION__ would hold ( string )[function name] Peter Beckman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there some sort of master variable which will tell you which function you are currently in? Like __FUNCTION__ like there is for __FILE__ and __LINE__... Something like that. Even a function that does that? I am writing a program in which several functions refer back to themselves by name, and it'd be nice to be able to do it dynamically. If I change a function name, then I have to change (currently) the string that contains the function name within that function. Peter -- - Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: function needed
Thank you all! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: function needed
Hi! This shouid be good: ?php function getdomainname($name) { if(substr($name,0,4)=='www.') $name = substr($name,4,(strlen($name)-4)); return substr($name,0,strrpos($name,.)); } echo getdomainname('www.nyloncoffee.interpc.pl'); ? short, nice and it's work good :) - Original Message - From: Shahar Tal [EMAIL PROTECTED] Newsgroups: php.db To: [EMAIL PROTECTED] Sent: Friday, January 24, 2003 6:44 PM Subject: function needed Hey I'm looking and wondering for a function, as i'm trying to do something, and here it is. I'm using the SSI call : !--#echo var=HTTP_HOST --. to get the domain name I am on. this will output www.domain.com. I would like to use PHP in order to take this string, the output, and cut the www. and the .com from it, so only the domain will remain. ofcourse we can also have situations whith .org and .net and even where there's no www. but the main thing I need is to remove whats after the second dot and before the first dot, along with the dots. I don't mind writing all the posibilities to the function, ie, all the possible extenstions that the function may need to cut, I just need it to take the text from the SSI, and cut everything but the domain part, which is the address itself. what would be the best way to do it? thank you!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: function ??
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: are INSERT INTO statements forbiden inside a function?? Assuming that you're referring to a PHP function and not a function of the RDBMS, no it's not forbidden. Show the relevant snip of code and any error messages being reported. Most likely, you've got a typo or syntactical problem that's causing the insert to fail (ex. forgetting to bring a global var into the function's local scope, an extra curly brace, missing quote, etc.). -- CC -- PHP Database 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-DB] Re: function ?? SOLVED
SOLVED Wrong varable! Is that as bad as spelling errors? Dave | In article [EMAIL PROTECTED], [EMAIL PROTECTED] | wrote: | | are INSERT INTO statements forbiden inside a function?? | | Assuming that you're referring to a PHP function and not a function of the | RDBMS, no it's not forbidden. Show the relevant snip of code and any error | messages being reported. Most likely, you've got a typo or syntactical | problem that's causing the insert to fail (ex. forgetting to bring a global | var into the function's local scope, an extra curly brace, missing quote, | etc.). | | -- | CC | | -- | PHP Database 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] | | [EMAIL PROTECTED] SeaPortNetHosting: Reliable Web Hosting Plans from $17.95 www.yourname.com http://www.SeaPortNet.com/ 1(209)551-7028 -- PHP Database 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]