3

I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between PHP/HTML with <? and ?>. That said, I find the language atrocious - Ruby and Python are considerably more expressive, yet since they're not web-specific, they lack both of those features - at least last I used them both.

So my question is, is there some way to get the practicality of PHP from Ruby or Python (specifically the two issues I mentioned)? If not, is there some other language that doesn't feel like a C/C++ parser gone wrong?

9
  • 6
    I hear people throw the 'expressive' word around a ton when talking about Python or Ruby, but I've never been able to find more 'expessiveness' in those languages in comparison to Perl, or PHP, or JavaScript. Can someone give me an example of 'expressiveness' where Python or Ruby is, but PHP isn't? May 6, 2013 at 15:16
  • Rails would give you all this and a bit more for Ruby and I think the same holds for Python with Django. May 6, 2013 at 15:17
  • 1
    Look at embedded ruby, though realize you don't want to write the entire application in .rhtml
    – user40980
    May 6, 2013 at 15:21
  • I've done Rails before; I don't like its forced approach to architecture.
    – Melllvar
    May 6, 2013 at 15:34
  • 1
    While I'll agree that that looks nice, I think arguments about its readability are completely subjective. May 6, 2013 at 16:13

2 Answers 2

2

Are you looking for something like Python Server Pages?

<html>
<%
  import time
%>
Hello world, the time is: <%=time.strftime("%Y-%m-%d, %H:%M:%S")%>
</html>
1
  • Looks like psp and eruby are the best alternatives; thanks
    – Melllvar
    May 6, 2013 at 17:41
3

Unless you're dealing with a large legacy codebase, it's relatively easy to avoid PHP's warts. Most hosts will have PHP 5.3 and, except for a few of the gems from 5.4, you're going to get a lot of functionality.

What specifically about PHP is it that you are trying to avoid?

3
  • As a scripting language, I find PHP not as expressive as either Ruby or Python. I realize this is rather subjective, and my goal here isn't to start an ideology war, but that's basically it. PHP got features like OO and lambdas way too late to make the language more elegant, and what it is today is something that looks like C (mind you, I have no problems with C itself), with random features that look out of place.
    – Melllvar
    May 6, 2013 at 17:35
  • 4
    If you're looking for an elegant language, then PHP is not it. There is no other language that is ubiquitous as PHP, though. May 6, 2013 at 17:38
  • That's exactly what I was trying to find out :)
    – Melllvar
    May 6, 2013 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.