How To Call or Do a Separate Subroutine in PHP?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How To Call or Do a Separate Subroutine in PHP?

Postby GreenWay2 » 28. January 2011 00:44

Is there a way to do a subroutine call in PHP?

Without being specific as to the coding details, would like to do something like the following:

If x = 1
call subroutine_a

If x = 2
call subroutine_b

where subroutine_a and subroutine_b are separate pre-defined chunks of PHP code.


1. how to define the two subroutines in PHP?

2. how to call a subroutine from within an IF statement?


Thanks in advance for your help.
GreenWay2
 
Posts: 7
Joined: 18. December 2010 23:28

Re: How To Call or Do a Separate Subroutine in PHP?

Postby JonB » 29. January 2011 02:00

I hope this helps and is germane to your requirements:

http://www.tizag.com/phpT/phpfunctions.php

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: How To Call or Do a Separate Subroutine in PHP?

Postby GreenWay2 » 30. January 2011 21:37

Thanks for your very helpful reply. Tizag.com’s explanations and the several examples on using the Function command seem very clear and useful.

Wound up reading about several other PHP-related topics on the site as well...

Seems to be a ‘keeper’.

Thanks again for your help.
GreenWay2
 
Posts: 7
Joined: 18. December 2010 23:28


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 126 guests