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
370
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
190
Other Decks in Programming
See All in Programming
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
150
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
5
1.5k
Go コードベースの構成と AI コンテキスト定義
andpad
0
150
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
330
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.5k
Developing static sites with Ruby
okuramasafumi
0
340
Implementation Patterns
denyspoltorak
0
140
ゲームの物理 剛体編
fadis
0
390
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
SQL Server 2025 LT
odashinsuke
0
120
Basic Architectures
denyspoltorak
0
150
Navigating Dependency Injection with Metro
l2hyunwoo
1
200
Featured
See All Featured
Scaling GitHub
holman
464
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Facilitating Awesome Meetings
lara
57
6.7k
Building Adaptive Systems
keathley
44
2.9k
We Are The Robots
honzajavorek
0
130
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
120
A Soul's Torment
seathinner
1
2.1k
30 Presentation Tips
portentint
PRO
1
180
Skip the Path - Find Your Career Trail
mkilby
0
28
The Cost Of JavaScript in 2023
addyosmani
55
9.4k
A Tale of Four Properties
chriscoyier
162
23k
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