Clase 6 Flashcards

1
Q

Variable global dentro de una función PHP

A

function sumar(){
// Forma 1
// global $x,$y;
// $suma = $x + $y;
// Forma 2
$suma = $GLOBALS[‘x’] + $GLOBALS[‘y’];
return $suma;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Función recibe parametro

A

function saludar($nombre){
$saludo = “Hola $nombre”;
echo $saludo;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Llamar una función

A

saludar(‘Sebastián’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

función con variable estatica.

A

function contadorLogin(){
static $login = 0;
echo “Logeado”;
echo $login;
$login++;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

función con variable estatica.

A

function contadorLogin(){
static $login = 0;
echo “Logeado”;
echo $login;
$login++;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly