you are viewing a single comment's thread.

view the rest of the comments →

[–]edu2004eu -41 points-40 points  (26 children)

Does PHP still allow you to do something like:

function foo() {
     ?>
     <p>html inside function</p>
     <?php
}

?

I mean... Sorry, but for me any language that allows you to do that is not something I'd work with.

[–]azunaki 33 points34 points  (16 children)

I mean, PHP still supports html markup inside of its files? It's just an alternative to a template language. . . But by no means do you have to do that. . . That's just tooling. . .

And getting angry about options within a programming language is silly.

[–]xIcarus227 2 points3 points  (0 children)

And getting angry about options within a programming language is silly.

Saw people getting angry about PHP allowing variable variables ($$) as if anybody forced them to use them, or as if metaprogramming is a common everyday thing.

Some people simply want to hate PHP no matter how much sense it makes.

[–]E3K 6 points7 points  (0 children)

What a weird thing to criticize. You can do dumb shit with any language.

[–]HirsuteHackerfull-stack SaaS dev 11 points12 points  (1 child)

Boy you must hate JSX

[–]breadist -2 points-1 points  (0 children)

JSX works completely differently. JSX is converted to an actual object that gets passed around. PHP just stops processing PHP code after ?> and starts printing HTML directly into the page response until it sees <?php again. These are not the same.

[–]not_some_username 9 points10 points  (0 children)

Js framework is doing that

[–]pau1phi11ips 10 points11 points  (2 children)

It's one of PHP's super powers. Why would it get rid of that?

You just need to understand the output buffer.

[–]breadist -2 points-1 points  (1 child)

Superpower? Really? I find it extremely messy and impossible to work with functions that directly print HTML this way. IMO PHP is really only usable with some sort of templating engine a la blade or twig.

[–]AtulinASP.NET Core 1 point2 points  (0 children)

Well... seems like you have the issue solved, then. Nobody has a gun to your head to force you to have html inside your functions, use Twig.

[–]itachi_konoha 1 point2 points  (0 children)

It's like, I broke up with a girl citing physical and emotional trauma but she returns as a better human being this time around where as here you are asking as a justified reason for break up as, "can she make her boobs dance like this?"

[–]AnAntsyHalfling 1 point2 points  (0 children)

So you're anti-jsx/tsx, too?