answersLogoWhite

0


Best Answer
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

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of function in PHP program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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?

A PHP function is a block of reusable code that performs a specific task. Functions can accept input parameters and return a value, making them useful for organizing and simplifying code. They allow you to encapsulate logic and execute it whenever needed within a PHP program.


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() { .................... }


What does the php function eval?

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


Is php an interpretor?

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


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>