article thumbnail

CodeSOD: //article title here

The Daily WTF

Menno was reading through some PHP code and was happy to see that it was thoroughly commented: function degToRad ($value). return $value * (pi()/ 180 ); // convert excel timestamp to php date. }. " [Advertisement]. But I'm not sure how that comment came to be." Keep the plebs out of prod. Learn more.

PHP 137
article thumbnail

CodeSOD: Imploded Code

The Daily WTF

Cassi ’s co-worker ( previously ) was writing some more PHP. Well, that seems like a perfect use case for PHP. "); n"; Now, PHP’s array_map is a beast of a function, and its documentation has some pretty atrocious examples. Lost my train of thought there when checking the PHP docs. Advertisement].

PHP 119
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

CodeSOD: PHP Error Logging

The Daily WTF

Today's anonymous submitter sends us some PHP exception logging code. This particular code shows a surprising understanding of some clever PHP tricks. They opted to use var_dump , a handy PHP debugging function which dumps an object's properties to the output buffer. Unfortunately, everything about it is still wrong.

PHP 59
article thumbnail

CodeSOD: Underscoring the Importance of Good Naming

The Daily WTF

Martin 's team had a problem in PHP. Being PHP, the empty function also doesn't check for empty strings, it checks for strings that can coerce to false (which includes the empty string, but also includes '0' ). See, the is_null function is, well, checking for nulls. It isn't checking for empty strings.

PHP 105
article thumbnail

Multilingual Development

The Daily WTF

You see, Bert was a PHP developer. He was building a PHP application. But he copy/pasted Lisa's Java code into a PHP file, and then remangled it until it was executable PHP. Much of his frustration was rooted in the fact that her code didn't even run when he copy/pasted it into a PHP file. Advertisement].

article thumbnail

CodeSOD: Monthly Totals

The Daily WTF

Daniel spotted an array called $months in a PHP application. Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. The data being stored in the array was some total of the sales of some commodity, for the past 5 months. That much all made sense.

PHP 111
article thumbnail

CodeSOD: Holiday Sample Pack

The Daily WTF

On the other hand, submitter Born 2 Ruby, Forced 2 PHP was hired to work on a Ruby on Rails application, but after starting, discovered that the RoR app was an aspiration and the day to day work was to keep the legacy PHP application from falling over in production. Advertisement]. Keep the plebs out of prod. Learn more.

PHP 98