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
320
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
170
Other Decks in Programming
See All in Programming
ドメイン駆動設計を実践するために必要なもの
bikisuke
4
340
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
400
Regular Expressions, REXML, Automata Learning
makenowjust
0
220
Rubyのobject_id
qnighy
6
1.3k
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
820
KSPの導入・移行を前向きに検討しよう!
shxun6934
PRO
0
290
What you can do with Ruby on WebAssembly
kateinoigakukun
0
170
Debugging: All you need to know (for simultaneous interpreting)
jmatsu
2
940
Crafting Cross-Platform Adventures: Building a Game Engine with Kotlin Multiplatform
dwursteisen
0
220
Developer Joy == Developer Productivity (really!)
hollycummins
1
230
私のEbitengineの第一歩
qt_luigi
0
450
LangGraphでのHuman-in-the-Loopの実装
os1ma
3
1.1k
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
190
16k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
The Invisible Side of Design
smashingmag
296
50k
Pencils Down: Stop Designing & Start Developing
hursman
119
11k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
Music & Morning Musume
bryan
46
6k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
4 Signs Your Business is Dying
shpigford
179
21k
Thoughts on Productivity
jonyablonski
66
4.2k
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Clear Off the Table
cherdarchuk
91
320k
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