php function

Solutions on MaxInterview for php function by the best coders in the world

showing results for - "php function"
Henri
25 Feb 2020
1<?php
2function writeMsg() {
3    echo "Hello world!";
4}
5
6writeMsg(); //call the function
7?>
Augustin
28 Apr 2017
1function functionName() {
2    //code to be executed;
3}
Mads
08 Jan 2021
1function functionName() {
2    //code to be executed;
3}
4functionName();
Atlanta
21 Apr 2016
1<html>
2   
3   <head>
4      <title>Writing PHP Function with Parameters</title>
5   </head>
6   
7   <body>
8   
9      <?php
10         function addFunction($num1, $num2) {
11            $sum = $num1 + $num2;
12            echo "Sum of the two numbers is : $sum";
13         }
14         
15         addFunction(10, 20);
16      ?>
17      
18   </body>
19</html>
Matilda
12 Feb 2016
1#functions
2
3<?php
4    #function - a block of code that can be repeatedly called
5
6    /*
7    How to format functions
8    1. Camel Case myFunction()
9    2.Lower case with underscore my_function()
10    3. Pascal Cae - MyFunction() usally used with classes
11    */
12    function simpleFunction(){
13        echo 'Hello John';
14
15    }
16    //Run the function like so
17    simpleFunction();
18
19    //function with param
20    function sayHello($name = " you out there!"){
21        echo "<br>and<br> Hello $name<br>";
22    }
23    sayHello('John');
24    sayHello();
25
26    //Reurn Value
27    function addNumbers($num1, $num2){
28        return $num1 + $num2;
29     }
30     echo addNumbers(2,3);
31
32     // By Reference
33
34     $myNum = 10;
35
36     function addFive($num){
37         $num += 5;
38     }
39
40     function addTen(&$num) {
41         $num += 10;
42     }
43
44     addFive($myNum);
45     echo "<br>Value: $myNum<br>";
46
47     addTen($myNum);
48     echo "Value: $myNum<br>";
49
50
51?>
queries leading to this page
pho functionrun a function in phpphp funtionmake function in php 24how to use in phpfunction in php example codefunction phpfunbction phpwhat is the correct way to create a function in phphow to write functions in phphow to create function in phphow to create a function in phpfuncion in phpfunctions phpphp functions exampleswrite a function and call it in phpffunction in phpphp define functionhow to write php functionhow to define function in phpfunction in phphow to create funcition in phpphp function callfunctions phpfunctiop in phpphp create funcdeclare a function in phpphp functionsphp main functionsimple php functionphp functioncreate an adding functin in phpfucntion phpphp make a functioncreate funtion phpdeclare functions in phphow to function syntax in phphow to use declare function in phpmake a function phpadding functions in phphow to write function in phphow to call a function in phpphp function funcionalitywrite the syntax for php functions 3f 2aphp function examplecreating a php functionfuntion in phpcreate a function in phphow to make a function in phphow to recognize user defined and built in function in phpphp how to make a functionwrite function in phpfunction called in phphow to make an php functiondefine a function phpdefine function in phpcreate functions phpcreate function phpdef functions phprun function phpfunction php returnphp function declarationphp functionsfuntction phphow to function phphow to use function phpcreate php functionhow to create function phpfor function jsphp make functionphp create functionmake a function in phpexecute function phpcreating function in phphow to write and call a function in phpfunction define in phphow to declare function in phpphp functinocreate function in php declare function phpdefine function phpphp functions with examplesfunctions in phpsyntax to declare function in phpphp gfunctioncreate function php htmlphp function