Strict PHP Pains

Hola amigos!

If you’ve upgraded your PHP recently then you’ll notice it’s a lot stricter about things. Good, I say. But there will be a painful transition as people will need to learn more and program less sloppy!
This post will be updated as I come across any new php 5.3+ strict error warnings on my travels.

Todays error message:

A non well formed numeric value encountered

This was in one of my view helpers for converting Unix time to something more humanly readable.

return date("H:m", $time);

Fixed using strtotime:

return date("H:m", strtotime($time));

Stay tuned for more programming woes!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s