Using the universal-transpiler library for SWI-Prolog, you can convert a subset of PHP into Ruby and several other languages. This is an example program with PHP source code as its input:
:- use_module(library(transpiler)).
:- set_prolog_flag(double_quotes,chars).
:- initialization(main).
main :-
Input = "function add($a,$b){return $a.$b;}function squared($a){return $a*$a;}function add_exclamation_point($parameter){return $parameter.\"!\";}",
translate(Input,'php','ruby',X),
atom_chars(Y,X),
writeln(Y).
This is the program's output in Ruby:
def add(a,b)
return a+b
end
def squared(a)
return a*a
end
def add_exclamation_point(parameter)
return parameter+"!"
end