Slide 1

Slide 1 text

php the good, the bad & the ugly ?>

Slide 2

Slide 2 text

This is a rant!

Slide 3

Slide 3 text

the good

Slide 4

Slide 4 text

(...)

Slide 5

Slide 5 text

GoodThingsToSay::find("php"); // []

Slide 6

Slide 6 text

the bad

Slide 7

Slide 7 text

The PHP hammer

Slide 8

Slide 8 text

NOT predictable

Slide 9

Slide 9 text

What’s wrong and what’s not? $foo->nonExistent // Warning $foo::nonExistent // Fatal error

Slide 10

Slide 10 text

Type hinting function foo(string $s) {} foo("hello world"); // PHP Catchable fatal error: Argument 1 passed to foo() must be an instance of string, string given

Slide 11

Slide 11 text

empty() “ A variable is considered empty if it does not exist or if its value equals FALSE” $var = ""; empty($var); // true, because "" == false

Slide 12

Slide 12 text

parse_str() parse_str("first=one&second=two"); echo $first; // one echo $second; // two

Slide 13

Slide 13 text

NOT consistent

Slide 14

Slide 14 text

htmlentities / html_entity_decode strpos / str_rot13 php_uname / phpversion base64_encode / urlencode, gettype / get_class underscores or not?

Slide 15

Slide 15 text

array_diff array_fill array_filter count shuffle sort array_* or not?

Slide 16

Slide 16 text

ascii2ebcdic bin2hex deg2rad strtolower strtotime “to” or “2”?

Slide 17

Slide 17 text

array_filter($input, $callback) array_map($callback, $input) strpos($haystack, $needle array_search($needle, $haystack) Argument order

Slide 18

Slide 18 text

NOT reliable

Slide 19

Slide 19 text

json_decode("null"); // null json_decode("invalid json"); // null json_decode

Slide 20

Slide 20 text

if (strpos("hello, world!", "hello")) { echo "found!"; } else { echo "not found :("; } // not found :( array_search, strpos

Slide 21

Slide 21 text

the ugly

Slide 22

Slide 22 text

demo!

Slide 23

Slide 23 text

Not just a rant :)

Slide 24

Slide 24 text

the good

Slide 25

Slide 25 text

New stuff ★ Namespaces ★ Closures ★ Traits ★ Better syntax

Slide 26

Slide 26 text

New ecosystem

Slide 27

Slide 27 text

New ecosystem

Slide 28

Slide 28 text

Conclusions ★ If you can, don’t use it! ★ If you have to: • know your enemy :) • take advantage of the new goodness