File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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);
You can’t perform that action at this time.
0 commit comments