Jump to content

PHP Procedures?


mtr4

Recommended Posts

Hi all,

 

A totally random question out of left field for you all!!  I know that PHP uses functions, but does it use procedures?  I know that MySQL you can have stored procedures, but anything PHP related?

 

Many thanks in advance!!

 

Matt

Link to comment
Share on other sites

I'm a teacher in the UK and one of our exam boards have said 

 

* know when the use of procedures or functions would make sense

* know how to write and use their own simple procedures and functions

 

The first part of it is easily understandable as there is the theory side of things for procedures, its writing a procedure in PHP which has me stumped

 

Matt

Link to comment
Share on other sites

I'm a teacher in the UK and one of our exam boards have said 

 

* know when the use of procedures or functions would make sense

* know how to write and use their own simple procedures and functions

 

The first part of it is easily understandable as there is the theory side of things for procedures, its writing a procedure in PHP which has me stumped

 

Matt

 

In PHP there is function() which does what traditional functions do and what traditional procedures or sub-routines do.  The normal distinction is that functions take arguments and based on those return a value.  Sub-routines or procedures normally don't return a value but instead carry out an action like modifying a table or sending an email etc.  In PHP functions are used for both.  In VB or VBA there are functions that return a value and subs that perform an action.  In MySQL I believe this is roughly the same, stored procedure vs. stored function.

Edited by AbraCadaver
Link to comment
Share on other sites

Personally, I'd take that as they have to write their code which interacts with the functions they've defined. As Abra said it's terminology across languages. 

 

I have a colleague who uses the language cobol and he calls function sub-routines or procedure.

 

I think it's only databases that make the distinction between procedures and functions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.