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
390
3
Share
PHP: The good, the bad and the ugly
Giuseppe Capizzi
December 17, 2012
More Decks by Giuseppe Capizzi
See All by Giuseppe Capizzi
A (not so) gentle introduction to functional programming
gcapizzi
1
190
Don't fear the paren! 8 reasons you should give Clojure a try
gcapizzi
4
210
Other Decks in Programming
See All in Programming
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.1k
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
460
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
3.5k
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
5.2k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
440
今さら聞けないCancellationToken
htkym
0
220
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
570
inferと仲良くなる10分間
ryokatsuse
1
360
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
140
Oxcを導入して開発体験が向上した話
yug1224
4
280
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
The Limits of Empathy - UXLibs8
cassininazir
1
350
The Cult of Friendly URLs
andyhume
79
6.9k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
170
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
ラッコキーワード サービス紹介資料
rakko
1
3.5M
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
Tell your own story through comics
letsgokoyo
1
940
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
550
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
BBQ
matthewcrist
89
10k
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