Pass an arguments to a function, PHP Web Programming

Assignment Help:

You can pass arguments to a function. These are variables, either strings or numbers, which are utilized inside the function. Certainly the output of the function based on the arguments you give it.

In the following instance we pass two arguments, the number 1 & the string 'house':

example(1,'house');

While these arguments arrive at the function, they are stored up in two variables, a & b. You ought to declare these in the function header, as you can look below.

function example(a,b)

<HTML>

<HEAD>

<TITLE>IGNOU </TITLE>

<SCRIPT Language = "JavaScript">

function example(a, b)

{

var number;

number += a ;

alert('You have chosen: ' + b);

}

</SCRIPT>

</HEAD>

<BODY>

<FORM NAME="selectForm">

<P><B>Click the button below:</B>

<BR>

<P><INPUT TYPE="button" VALUE="Click" onClick="example(1,'house')">

</FORM>

</BODY>

</HTML>

2095_Pass An arguments to a function.png

Figure: Using Functions

This adds one to number and displays "You have decided: house". Certainly, if you call the function like example (5,'palace'), then it adds five to number & displays "You have decided: palace". The output of the function based on the arguments you give it.


Related Discussions:- Pass an arguments to a function

I want help in api integration, I want help in API Integration The ecomm...

I want help in API Integration The ecommerce platform we use has an API as layed out and we have some third paries we would like to incorporate starting with invitebox.com. More

I am seeking of a wordpress plugin, I am looking to get a basic rundown on ...

I am looking to get a basic rundown on the time and cost that would be required to develop a WP plugin. This plugin would do two things- a) Build sales landing pages b) Split

We need help in custom hook for a wordpress plugin, We need help in Custom ...

We need help in Custom Hook for a Wordpress plugin We are in search of someone that can create a custom hook from one plugin into another. The logic is that while a user clic

Distinguish between complex type and simple type elements, Question: (a...

Question: (a) Explain the concept of "mixed content" in an XML document. What restrictions are placed on the definition of elements with mixed content by Document Type Defini

I have two php projects that need to be completed, I have two projects that...

I have two projects that need to be completed Project 1: This website wouldn't be for me. I'm not seeking to profit from the work you do on this job. Just helping out a friend.

Confirm boxes, The JavaScript confirm alert box differs through a regular a...

The JavaScript confirm alert box differs through a regular alert box in which it provides two choices to the user, OK & Cancel. Typically, you'll see confirmation boxes utilized on

Help in google feeds not working in magento site, Help in Google Feeds not ...

Help in Google Feeds not working in Magento Site We are in want of superb magento developer. We have some clients sites that are all made in different platforms like wordpress,m

Differences between include(), Question: (a) What are the differences ...

Question: (a) What are the differences between include(), require() and include_once()? (b) Convert the below if-elseif code to its equivalent switch case version: $day

I need a continuing education website, I need a Continuing Education Websit...

I need a Continuing Education Website Please see attached PDF for job specifications. We will be selecting a freelancer within the next week if one meets our needs and budget. T

Need help to create amazon affiliat store, Amazon Affiliat Store I need ...

Amazon Affiliat Store I need your services to build me an Amazon Affiliate Webstore (for Health as well as Personal Care Products). Script must import inventory from amazon. Int

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd