Use Arguments and Its Definition

In the first look, the word argument can be confusing as in the English language the word argument has the meaning of arguing with the person in an angry tone.

Simply tell you, there is no connection between the English word "Arguments" and the php word "Arguments" in the php language. I really don’t know why the php developer chose the word. Maybe two developers were arguing on their salary issue while coding the php language.

So in php, the word arguments represent the information that eventually you will display after running the php code. The argument is similar to a variable. The code or the word that you use in the argument is stored as information like variable does and it presented when you run the echo statement.

Let’s see the example of the argument php code.

<?php
function familyName($fname) {
echo "$fname Refsnes.<br>";
}

familyName("Jani");
?>

In above code, the word "$fname" represent the argument. It is a user defined argument, it means you can name as you like. e.g. gname, yname, runfast etc. The argument stores the information which is later added to the function and display the content when you run the php code in the browser.

The echo code "$fname Refsnes.<br>" is saying check the "$fname" from the above function.

The "familyName("Jani"); " is saying use the word "Jani" as "$fname". In php term, the "jani" has stored the value of "$fname". And don’t forget the "$fname" is your argument also known as a variable.

When you run the php code you will get the below result.

Jani Refsnes.

The code has used the "$fname" which has value "Jani".

Hope now you are ready for an argument.

Related Posts

Leave a Reply