Look, there are two things you are saying. One is "you can't do this with Ruby/Python" -- which is a superiority-of-PHP argument -- and the other is a plea of "PHP has done a lot, so let's not be too hasty dismissing it." You made both of these arguments. In fact, you made the first one in this very comment where you say you're not arguing for PHP's superiority over other languages.
In some ways this is true but I would be hesitant. What you're really advertising is that PHP has an implicit `echo("` statement which looks like `?>` and also implicitly occurs at the beginning of the file. A lot of new folks write really hard-to-follow code. Here is the seed of badness from which such code eventually germinates and blossoms:
' . $user['name']. '';
?>';
If you do not see why this is bad, imagine that you have a loop within a loop and they get separated by more than 20-30 lines of PHP. Notice how some of the HTML occurs within the PHP statement but pairs with tags outside of the PHP statement, and imagine functions which are producing such code. Et cetera.
Python+Flask will force you to either do it in a Jinja template, which avoids the problem because you cannot 'return back to Python' midway through:
{% for user in users %}
{{ user.name }}
{% endfor %}
Or else you could define the file within Python using strings, in which case your syntax highlighter will be able to tell you exactly where these strings begin and end:
output += """
""" + "".join(["""
%s""" % (u['id'], u['name'])
for u in users]) + """
'%s % (u['id'], u['name'])
for u in users]) + """
Of course, Jinja is more readable in this case, and that's kind of the point. For most web apps, you want a sort of preamble which calculates and formats a bunch of information, selects a template, and renders the template to the user. For PHP, this preamble is Apache, and if you want more, you probably need to generate an include() file to force yourself to stay sane. (PHP doesn't force this however, and many people write bad code which simply does the calculations in the HTML wherever they are needed -- and then you get massive code duplication and the joys of trying to match curly braces through large blocks of HTML.)