23.03.2017 Views

wilamowski-b-m-irwin-j-d-industrial-communication-systems-2011

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

62-6 Industrial Communication Systems<br />

Example:<br />

<br />

Output: 1 2 3 4 5<br />

62.3.4 Functions<br />

Functions contain scripts that are called to execute whenever a page loads or is called from anywhere within<br />

a page. There are around 700 built-in functions available in PHP such as date function, string function, calendar<br />

function, array functions, etc. You can create your own function to achieve a specific goal.<br />

Syntax:<br />

function functionName(){<br />

code to be executed;<br />

}<br />

Example 1: Without parameters<br />

<br />

Output: function code is executed and displayed<br />

Example 2: Parameters and return values<br />

Parameters are declared inside the parenthesis. Parameters are just like variables that store information<br />

within the function.<br />

<br />

Output: Sum is 6<br />

62.3.5 Include Function<br />

If you want to include one PHP file in another PHP file, include() or require() functions is used to take<br />

the content of one file and include it in the current file.<br />

© <strong>2011</strong> by Taylor and Francis Group, LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!