answersLogoWhite

0


Best Answer

function myFunction($parameter1, $parameter2) {

// this function's code goes here

return $returnValue; // the value returned

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the correct way to create a function in php?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the way to create a function in PHP?

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


How can files be converted into HTML using PHP?

To rename a file in PHP the easiest way to do it is to use the rename() function. <?php rename("before.txt", "after.html"); ?>


How crearte a function in php?

The simplest way (the old procedural way) is to just declare the function: function ourSimpleFunction(){ //Function Guts } Functions do not require a return type, or typed arguments in PHP, however you can use type-hinting if it makes you feel better.


What is the correct way to include the file?

<?php include_once('<path_to_file>/time.inc'); ?>


What are the correct and the most two common way to start and finish a PHP block of code?

`<?php` then a `?>` and also `<?=` and `?>` are the only compliant methods now that PHP 7 is out.


The correct way to write Hello World in PHP is?

echo("hello world");


What is the correct way to include the file time.inc?

<?php include_once('<path_to_file>/time.inc'); ?>


What are the available encryptions in PHP?

PHP has built-in one way hashing using the md5 function. Additional encryption capabilities are available using the Mcrypt extension.


What is the correct way to add comment in PHP?

// For single line comments /* Your comments here */ For multi-line comments


What is php extension?

We can write php extension is many way... .php , .php5, .php4


What is the best way to write an array to a file in PHP?

The serialize() function is used to create a storable representation of a variable in PHP.To store an array to a file, you first use the serialize() function to change an array into a string. Save the string in a file using file I/O, so fwrite() or a similar function. When reading it use unserialize() to get the original array again.


How do you find version of PHP in uniform server?

The easiest way is to create a file with a name ending in .php (such as info.php), containing only these 3 lines: <? phpinfo(); ?> Upload this file to your web space and access it using your browser. It will show a lot of information about your webserver and the php version running on it.