mtr4 Posted August 21, 2013 Share Posted August 21, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/ Share on other sites More sharing options...
AbraCadaver Posted August 21, 2013 Share Posted August 21, 2013 In some languages there are differences between functions and procedures or sub-routines, but for the most part, and in your question they are really the same. What are you trying to accomplish? Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/#findComment-1446132 Share on other sites More sharing options...
mtr4 Posted August 21, 2013 Author Share Posted August 21, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/#findComment-1446134 Share on other sites More sharing options...
Barand Posted August 21, 2013 Share Posted August 21, 2013 A procedure is merely a function that doesn't return a value (void function) Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/#findComment-1446136 Share on other sites More sharing options...
AbraCadaver Posted August 21, 2013 Share Posted August 21, 2013 (edited) 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 August 21, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/#findComment-1446137 Share on other sites More sharing options...
exeTrix Posted August 21, 2013 Share Posted August 21, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/281432-php-procedures/#findComment-1446139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.