tags:

views:

54

answers:

3

I'm trying to come up with a solution to this problem. I have a Ruby script that needs to run some PHP code, but I am new to Ruby, so I don't know how to go about doing this.

def run_my_code
    #execute some PHP code here
    # $person = new Person();
    # $person->doSomething();
end

How can I achieve this?

+2  A: 

one way is to use exec

http://ruby-doc.org/core/classes/Kernel.html#M005968

also `ls` or `cmd` works too (back tick)

動靜能量
A: 

Look at Erubis. It supports PHP and other languages (Ruby/PHP/C/Java/Scheme/Perl/Javascript).

NARKOZ
A: 

I've heard of Phuby, though I haven't used it myself.

Andrew Grimm