₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,412 members, 8,421,786 topics. Date: Sunday, 07 June 2026 at 03:45 AM

Toggle theme

Difference Between Arguments And Parameters In PHP - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersDifference Between Arguments And Parameters In PHP (760 Views)

1 Reply

Difference Between Arguments And Parameters In PHP by maekhel(op): 8:58am On Jan 07, 2015
We will be looking at an interesting topic today: Difference Between Arguments And Parameters. No doubts most of us do use these two terms interchangeably while working with functions. New to functions? read my other tutorial Functions In PHP.
These two terms can be confusing and are mostly used in place of the other, but as a programmer you should be able to identify and use your terms properly.So what are arguments and parameter?
Let start with Arguments. Arguments are the passed to a function when the function is called. Those items supplied to a function are what is referred to as argument.
While Parameters on the other hand are passed to a function when it is declared or created. These items passed to a function are what the function is a excepting as arguments.
Sound confusing right? Let clarify things with a simple example:
<?php
/**let create a simple function to find the area of a rectangle
*$length and $breath are our parameters
*/

function findArea($length, $breath){
return $length * $breath;
}
/**now let make use of our findArea()
*$len and $bre are our arguments
*/

$len = 4;

$bre = 9;

findArea($len, $bre);

//this will output: 36

?>
Conclusion
The example should make things more clearer now, so learn and start using the right terms. I hope this brief tutorial was helpful. Comments, questions, suggestions and views are all welcomed, will love to hear from you. Also remember to subscribe to our newsletter to receive more of great tutorials.
source: http://tutorialslodge.com/difference-arguments-parameters-php/
1 Reply

The Difference Between Dynamic Ip And Static IpWhat Is The Difference Between .ng And .com.ng DomainWhat Is The Major Difference Between Python And Php234

"Blogging"-how Did Bloggers Cope With Nigeria Electricity In Updating Their SiteI Want To Buy Adsense...lagos OnlyMaximize Your Adsense Earnings With $1 Facebook Advertising