Skip to content

Commit 91f7784

Browse files
committed
Create 06_functions.php
PHP Functions. link: https://www.w3schools.com/php/php_functions.asp
1 parent 04b3e6a commit 91f7784

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

06_functions.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/*Eng: PHP Functions:
3+
A function is a block of statements that can be used repeatedly in a program.
4+
A function will not execute automatically when a page loads.
5+
A function will be executed by a call to the function.
6+
/*Pt: Funções PHP
7+
Uma função é um bloco de instruções que podem ser usadas repetidamente em um programa.
8+
Uma função não será executada automaticamente quando uma página for carregada.
9+
Uma função será executada por uma chamada para a função.
10+
*/
11+
12+
//Eng: function register user || Pt: função registrar usuário
13+
function registerUser()
14+
{
15+
echo "User registered !!! <br>";
16+
}
17+
registerUser(); //using the function
18+
19+
//Eng: sum function || Pt: função soma
20+
function sum($x, $y)
21+
{
22+
return 'sum result:' . ($x + $y);
23+
}
24+
sum(1, 2); //using the function
25+
26+
27+
28+
//Eng: Arrow functions have the basic form fn (argument_list) => expr. || Pt: As funções de seta têm a forma básica fn (argument_list) => expr.
29+
//Eng: sum result variable || Pt: variável resultado da soma
30+
// $somResult = 0;
31+
// //Eng: Arrow functions. || Pt: As funções de seta.
32+
// $somResult = fn($n1, $n2) => $n1 + $n2;
33+
// echo $somResult(1,2);

0 commit comments

Comments
 (0)