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
360
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
160
Don't fear the paren! 8 reasons you should give Clojure a try
gcapizzi
4
180
Other Decks in Programming
See All in Programming
CSC509 Lecture 05
javiergs
PRO
0
300
Railsだからできる 例外業務に禍根を残さない 設定設計パターン
ei_ei_eiichi
0
360
Чего вы не знали о строках в Python – Василий Рябов, PythoNN
sobolevn
0
160
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
210
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
200
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
170
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
5
2.2k
Breaking Up with Big ViewModels — Without Breaking Your Architecture (droidcon Berlin 2025)
steliosf
PRO
1
350
CSC509 Lecture 04
javiergs
PRO
0
300
クラシルを支える技術と組織
rakutek
0
190
Model Pollution
hschwentner
1
190
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
240
Featured
See All Featured
A designer walks into a library…
pauljervisheath
209
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Optimizing for Happiness
mojombo
379
70k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
How to train your dragon (web standard)
notwaldorf
96
6.3k
Six Lessons from altMBA
skipperchong
28
4k
The Cost Of JavaScript in 2023
addyosmani
53
9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
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