-1

I know PHP well but I'm new to Ruby on Rails, I am about to learn it.

The thing is that I would like to have PHP code inside Ruby code, or something similar to this. Could there be a way to do that, even if it's hard to achieve ?

nicael
  • 18,550
  • 13
  • 57
  • 90
Guillaume Chevalier
  • 9,613
  • 8
  • 51
  • 79
  • Me too "know PHP well but new to Ruby on Rails". Struggling with rails but ruby is not a problem. Learn ruby from http://mislav.uniqpath.com/poignant-guide/book/ and rails from http://ruby.railstutorial.org – Neeraj Jul 24 '13 at 05:23
  • You don't want write a bad code because of lack of knowledge, but mix the things in such way is one of the worst thing you could ever do. Such code would be supported by nobody except you. People choose Ruby because it doesn't have problems that PHP has. It would be much better to improve a Ruby code rather than rewrite an embedded PHP. Which, I'm sure, you will do if you will mix them. At last I would say «It's not a Ruby way» ©. –  May 11 '14 at 19:04

1 Answers1

0

You can invoke PHP interpreter from inside Ruby as an external command, whether with system, backticks, popen3 or another mechanism. But why would you want that?

Amadan
  • 191,408
  • 23
  • 240
  • 301
  • Because I want to learn ruby on rails slowly and if I use it while I'm a beginner I would like to complete some parts of my code with PHP – Guillaume Chevalier Jul 24 '13 at 21:35
  • I suggest you first learn Ruby. Much of RoR will not make sense otherwise. RoR is not a language; it just helps you deal with the database and web; and nothing of it can be easily replaced by a PHP subprocess. – Amadan Jul 25 '13 at 05:20