answersLogoWhite

0

The function keyword in PHP allows users to define functions beyond those built into the language, like so:
function isFour ($number) { return $number == 4; }

Functions in any language, including PHP, allow the developer to re-use their code.
Without functions all of the code required to do the simplest of tasks must be re-written constantly; but with functions you must only write the code once and then call it whenever needed.
User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

PHP program for electrical bill calculation?

<?php function calculate_electric_bill( $cost_per_kilowatt, $killowatts_used ) { return $cost_per_kilowatt * $kilowatts_used; } echo calculate_electric_bill( 0.01, 1000 );


What is a PHP file?

A PHP file is a text file containing code to be run on a webserver by a program called php. It's the most used dynamic page script engine as it is free and open source.Use the fopen() function to open files in PHP. The first parameter of this function is the file to be opened and the second parameter specifies in which mode the file should be opened


Where can I find free php codes?

Ratinonal program in php


What is a PHP function?

Functions are basic blocks of code that work together. Functions can be used from the core PHP or can be created by users. To create a function, use the following syntax: function function_name(arg1, arg2, ... argX) { //Any valid php code here } To use a function, use the following syntax: function_name(arg1, arg2, ... argX);


What purpose does php mail serve?

PHP mail has a variety of functions. The main function is to reroute mail from one server to another. The benefit of doing this is so one doesn't overload the current server.


How does PHP function in applications?

in php used for one typ website


How do you use settime out in php?

we cant use set timeout function in php because it is of java script function


How do you return a value in a PHP function?

Below is a simple example of how you could return a value in a PHP function. <?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?>


What is the way to create a function in PHP?

function function_name() { .................... }


Is php an interpretor?

PHP is in interpreted language, and ships with one, however PHP itself is a program language and not an interpreter.


What does the php function eval?

The eval() function evaluates a string as PHP code. http://us.php.net/manual/en/function.eval.php


How do you use a function with a button in PHP?

A simple function call <html> <body> <?php if(isset($_POST['button'])) { setValue(); // Function is called } function setValue() { echo "<br>The button property to call PHP function works"; // Your code here } ?> <input type="submit" name="button" onclick=<?php $_SERVER['PHP_SELF']; ?> /> </body> </head>