views:

63

answers:

1

Is it possible to translate everething written in OCaml to PHP? for example will it be hard to translate such lib as lib for Fast content-aware image resizing

+1  A: 

Short answer, yes, long answer yes, but it might be difficult. In this particular case the author translated code from Python (code found here) into OCaml. Additionally you can read the paper that presents the algorithm here (pdf link). Given that you have two implementations and access to the paper describing the algorithm I'd say guess that it won't be difficult to implement in PHP.

That said, OCaml is a compiled language and will run a lot faster than PHP. The Python implementation uses a lot of C libraries to speed it up (and is still half as fast as the OCaml implementation).

Niki Yoshiuchi