writing php – the wordpress way! by rahul bansal @wordcamp mumbai 2017
TRANSCRIPT
Writing PHP! The WordPress Way!
@rahul286
Agenda! 🎯
Why? 🕵
What Can Go Wrong? 💣
“ANYTHING THAT CAN GO WRONG, WILL GO WRONG!”
-Murphy's Law 😈😛
Different PHP Versions 🎲
PHP Versions used by
WordPress sites
Different PHP Extensions 🎭
Examples! 🎉
curl() vs
wp_remote_*()
White Screen of Death! ☠
array_merge() vs
wp_parse_args()
$input_string = 'type=post&posts_per_page=5&cat=1'
$input_array = array ( 'type' => 'post', 'posts_per_page'
=> 5, 'cat' => '1' )
Example of Example! 🤓
parse_url() vs
wp_parse_url()
json_encode() vs
wp_json_encode()
array_column() v/s
wp_list_pluck()
intval() vs
absint()
More WordPress Ways 🎩
• checked()
• selected()
• wp_dropdown_pages()/users()/*()
Helper Functions
Takeaway! 🤓
Did you find this useful? 😉
We are “always” hiring! 🤗
careers.rtcamp.com
Thanks!