News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Leve.rs:
Array Manipulation in PHP, the Correct Way
November 08, 2013 @ 10:08:04

On the Leve.rs blog there's a recent post showing what they consider is the right way to work with arrays in PHP. It shows three things you can do to use PHP's own functionality to more correctly perform some common array operations.

More often than not, when PHP developers debug others' code, the majority of each method is taken up by array manipulations. Spending this much time on array manipulations is a huge hassle when trying to understand any given method. In order to speed up the debugging process, it's important to start writing array manipulations the correct way, first. Here are a few examples of code I have either written myself or had to fix in the past. It is time every PHP developer knows how to manipulate arrays properly!

Their three tips relate to:

  • Merging Arrays
  • Array Value Manipulation (with array_walk)
  • Array Value Manipulation (append with the plus sign, "+")
0 comments voice your opinion now!
array manipulation correct merge value walk plus

Link: http://leve.rs/blog/correct-array-manipulation-in-php/

Gareth Heyes:
Tweetable PHP-Non Alpha
December 13, 2012 @ 09:40:25

Gareth Heyes has a new post that shares some of his efforts to write "non-alpha PHP", using characters other than the alpha-numeric ones to write executable PHP scripts. In his case, this involves a lot of pluses, underscores and square brackets.

I started to try and break the 10 charset limit of PHP non-alpha after @InsertScript showed me that PHP Dev supports [] syntax for arrays. I wondered if it would be possible to break the limit within production PHP. At first I thought you could but then after some testing I found that there was no way to concat without "." and no way to call a string as a function without $ and =. However since I got into PHP Non-alpha again I thought why not try and improve it and make the code tweetable.

He works through the whole process of his discovery - starting with the creation of a non-alpha version of "0" (zero), moving into letter creation and finally all the way up to a full word..."assert". The result is tweetable code that echoes that string and contains more symbols than letters. If you're interested in more of this non-alpha kind of coding, check out some of the other posts on his blog.

0 comments voice your opinion now!
nonalpha code tweet plus underscore squarebracket


Ian Christian's Blog:
Should you learn a framework?
August 01, 2008 @ 12:57:12

With more and more frameworks popping up every day in the PHP community, it's important to ask yourself one question - should I learn a framework? Ian Christian tries to answer that question in a recent post to his blog.

With other programming languages designed for the web, there's typically a framework that works hand in hand. [...] I imagine people will always write from the ground up with PHP, some people do it to learn, some I suspect think there's nothing out there that can do what they want, where as others perhaps do it just to prove themselves, or to gain fame. Good luck to them all, some of them are probably going to do a good job, but alas - I imagine most are wasting their time.

He breaks his opinions out into two sides of the argument - the business issues and the developer side, each with their own plusses and minuses. Overall, though, he definitely suggests learning some kind of framework, even if you don't end up working with it - it's just good experience.

0 comments voice your opinion now!
framework learn opinion business developer perspective plus minus


Dallas PHP Users Group:
PHP4 to PHP5 Minor gotcha
January 12, 2006 @ 06:58:21

On the Dallas PHP Users Group website today, there's quick little "gotcha" by MonkeyT when it comes to using the strtotime() function.

strtotime translates a date presented in various formats into a unix timestamp. It allows the syntax "+2 weeks" and various other time units to push that chosen date translation into the future. In 4.3.10, php would allow a space between the + and the beginning of the parameter. that doesn't seem to be the case any more. ("+3 days", not "+ 3 days"). Other than that, pretty smooth changeover so far.

It's pretty subtle, but I could potentially cause some headaches in the future - so keep an eye out!

0 comments voice your opinion now!
php4 php5 upgrade strtotime space after plus php4 php5 upgrade strtotime space after plus



Community Events





Don't see your event here?
Let us know!


symfony bugfix tips developer community library interview threedevsandamaybe framework release deployment zendserver language series list introduction podcast opinion api laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework