Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 849 Bytes

PHP.md

File metadata and controls

71 lines (57 loc) · 849 Bytes

PHP WAT?

Floating point imprecision

> 0.1 + 0.7
0.7999999999999999

How PHP increments strings

> $a = 1;
> $b = 3;
> echo $a++ + $b;
4
> echo $a + ++$b;
6
> echo ++$a + $b++;
7
> $a = 'fact_2';
> echo ++$a;
fact_3
> $a = '2nd_fact';
> echo ++$a;
2nd_facu
> $a = 'a_fact';
> echo ++$a;
a_facu
> $a = 'a_fact?';
> echo ++$a;
a_fact?

The mystery of value appearance

> $array = array('isReady' => false, 'isPHP' => true, 'isStrange' => true);
> in_array('sitepoint.com', $array);
true
> $array = array('count' => 1, 'references' => 0, 'ghosts' => 1);
> in_array('aurelio', $array, true);
true

References