NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP "function"

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 10-17-2005, 01:51 PM THREAD STARTER               #1 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




PHP "function"


Hey, can anybody explain to me the basics of "function" and "case" which are used in PHP. A link to a tutorial would be cool also. Thanks
Encenta.com is offline  
Old 10-17-2005, 02:19 PM   #2 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,267
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Hello,

Sure first lets start with case.

CASE is a function used by the function switch. Switch is commonly used when having alot of if and else commands insted of if and else. It does the same thing.
IF are more faster when doing small if and else command but time consuming when you have around 20 of them. So PHP made a function which allowed you to do this more cleanly and faster processing.
Switch tells the computer to check the variable for cases. Or if non found it does what default is set to.
Example:
PHP Code:
$happy 'HELLO';
switch 
$happy {
case 
'Hi':
// Do something
break;
case 
'HELLO':
// Do something
break;

(As shown here http://ca.php.net/manual/en/control-...res.switch.php )
As for a tutorial you can find one at that php link above.

Now for functions.
Function pretty much sets a function. Tells the browser to set a class function so when called it processed it and returns a value (Wether true or false)
Example
PHP Code:
function bob() {
????: NamePros.com http://www.namepros.com/programming/132602-php-function.html
????: NamePros.com http://www.namepros.com/showthread.php?t=132602
print 
'hello';
}

bob();
// Will print hello
?> 
You can also transfer variables through a function like this
PHP Code:
function bob($bob) {
print 
'$bob';
}

bob('hello');
// Will print hello
?> 
This will call the function bob. Passing the value of hello to the variable bob. It will than print hello.


Thanks,
iNod
__________________
I feel old.
iNod is offline  
Old 10-17-2005, 02:31 PM THREAD STARTER               #3 (permalink)
SQLdumpster.com
 
Encenta.com's Avatar
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 579
Encenta.com has a spectacular aura aboutEncenta.com has a spectacular aura about
 




Thank you very much!
NP$ Donated and Rep added!
Encenta.com is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
PHP Editor Software List Ber|Art Free Resources 3 08-22-2004 08:59 AM

 
All times are GMT -7. The time now is 02:02 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger