Smasty.net

Webdesigner, PHP programmer, Front-end developer.

10 PHP One Liners to Impress Your Friends

After 10 Scala / CoffeeScript / Ruby / Python / Haskell / Clojure / C# / F# / Groovy one liners to impress your friends, here are the PHP one liners.

1. Multiple Each Item in a List by 2

2. Sum a List of Numbers

3. Verify if Exists in a String

4. Read in a File

5. Happy Birthday to You!

6. Filter list of numbers

7. Fetch and Parse an XML web service

8. Find minimum (or maximum) in a List

9. Parallel Processing

I didn't even know it's possible to fork() in PHP…

10. Sieve of Eratosthenes

Finally, I don't think it's possible to do this as a One Liner in PHP. Tweet me if you can do this. Thanks to Tom Van Looy, here is the missing PHP one liner.