Playing with PHP functional way

I’m still inspi­red by Scala way of thin­king. I wonder if some func­tio­nal para­digms can be smug­gled into PHP. My goal is to quic­kly code flexi­ble string conver­ter without using loops or if’s (ternary opera­tors don’t count ;-) ). I’ll be using func­tions that take other func­tions as their argu­ments, which are known as higher order func­tions in Scala. Of course, in Scala you can force what kind of argu­ments func­tion takes, and what it returns. In PHP you can use calla­ble type­hint and tedious reflec­tion processing.

Enough talking, gimme some code!

Podobne wpisy:

  1. Func­tion over­lo­ading in JavaScript
  2. Compu­ting file hashes using Scala
  3. Using PHP traits to check class constants values
  4. 2 ways to check stream mimetype

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany.

Możesz użyć następujących tagów oraz atrybutów HTML-a: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <p> <pre lang="" line="" escaped=""> <q cite=""> <strike> <strong>