Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP: The good, the bad and the ugly
Search
Giuseppe Capizzi
December 17, 2012
Programming
3
300
PHP: The good, the bad and the ugly
Giuseppe Capizzi
December 17, 2012
Tweet
Share
More Decks by Giuseppe Capizzi
See All by Giuseppe Capizzi
A (not so) gentle introduction to functional programming
gcapizzi
1
140
Don't fear the paren! 8 reasons you should give Clojure a try
gcapizzi
4
160
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Implementing Design Systems in Swift
seyfoyun
2
480
Balkan Ruby 2024 — How and why to run SQLite on Rails in production
fractaledmind
0
100
2 週間で Twitter Bot を作ってみた
contour_gara
0
790
Elm Form Validation
bkuhlmann
0
520
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
110
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.3k
Deep Dive into React Stream/Serialize
mugi_uno
3
720
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
390
Code Reviews
bkuhlmann
4
900
Try creating your own orderedmap
kazamori
1
240
Fragment Composition of GraphQL
quramy
13
1.5k
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
74
8.2k
How to train your dragon (web standard)
notwaldorf
75
5.2k
Code Review Best Practice
trishagee
56
15k
The Cost Of JavaScript in 2023
addyosmani
21
3.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
21
1.6k
Faster Mobile Websites
deanohume
300
30k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Documentation Writing (for coders)
carmenintech
60
4k
How STYLIGHT went responsive
nonsquared
92
4.8k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Designing Experiences People Love
moore
136
23k
What's in a price? How to price your products and services
michaelherold
238
11k
Transcript
php the good, the bad & the ugly ?> <?
This is a rant!
the good
(...)
GoodThingsToSay::find("php"); // []
the bad
The PHP hammer
NOT predictable
What’s wrong and what’s not? $foo->nonExistent // Warning $foo::nonExistent //
Fatal error
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
empty() “ A variable is considered empty if it does
not exist or if its value equals FALSE” $var = ""; empty($var); // true, because "" == false
parse_str() parse_str("first=one&second=two"); echo $first; // one echo $second; // two
NOT consistent
htmlentities / html_entity_decode strpos / str_rot13 php_uname / phpversion base64_encode
/ urlencode, gettype / get_class underscores or not?
array_diff array_fill array_filter count shuffle sort array_* or not?
ascii2ebcdic bin2hex deg2rad strtolower strtotime “to” or “2”?
array_filter($input, $callback) array_map($callback, $input) strpos($haystack, $needle array_search($needle, $haystack) Argument order
NOT reliable
json_decode("null"); // null json_decode("invalid json"); // null json_decode
if (strpos("hello, world!", "hello")) { echo "found!"; } else {
echo "not found :("; } // not found :( array_search, strpos
the ugly
demo!
Not just a rant :)
the good
New stuff ★ Namespaces ★ Closures ★ Traits ★ Better
syntax
New ecosystem
New ecosystem
Conclusions ★ If you can, don’t use it! ★ If
you have to: • know your enemy :) • take advantage of the new goodness