Numbers Flashcards

1
Q

What are the possible simple arithmetic operation we can do with PHP?

A

$a + $b
$a - $b

$a * $b
$a / $b

$a % $b

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

How do you do the assignment and operation at the same time?

A

para decir $a = $a + $b
$a += $b

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

Which ones are the incremental operators?

A

$a++

++$a

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

Which ones are the decrement operators?

A

$a–

–$a

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

How do you convert a string into number?

A

if I have $strnum=’12’

floatval($strnum)

o

intval($strnum)

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

Which ones are the most common number functions?

A
  1. abs(-15)
  2. paw(2,3)
  3. sqrt(16)
  4. max(2,3)
  5. min(2,3)
  6. round(2.6) => 3
    round(2.4) => 2
  7. floor(2.6) => 6
  8. ceil(2.4) => 3
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you get the absolute number?

A

abs(-15)

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

How do you get a number elevated to another number?

A

pow(2,3)

=> me daria 8 porque es 222

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

Como obtengo la raiz cuadrada de un número?

A

sqrt(16)

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

How do I get the maximum number of a range of numbers?

A

max(2,3,4,5,6)

separo los numeros por coma

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

How do i get the minimum number of a range of numbers?

A

min(2,3,4,5,6)

los separo por comas

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

Como funciona el método round()?

A

si es < a .5 redondea para abajo, y si es >= .5 redondea para arriba.

Entonces

round(2.5) va a ser igual a 3
y
round(2.4) va a ser igual a 2

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

How do I make it always to round down?

A

with floor()
floor(2.6) => 2

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

How do I make it always round up?

A

with ceil()
ceil(2.4) => 3

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

How can you change the format of a number?

A

number_format($number,number of decimals, ‘qué separa los decimales’, ‘qué separa los miles’)

$number=123456789,123
number_format($number,2, ‘,’,’ ‘)
=>
123 456 789,12

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