Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
PHP 5.3
« on November 12th, 2010, 12:21 AM »
I've been looking at PHP 5.3 today, never really touched it before since prior to what I'm doing this moment, everything had to be reasonably compatible, which meant being less bleeding edge, but what I'm working on tonight is something I'm running myself so I thought I'd look at PHP 5.3.

Overall, vs 5.2 there's little there I think I'd use but it's nice to see some of what they're adding. What did catch my eye however, was this: http://uk2.php.net/manual/en/control-structures.goto.php

The picture at the bottom for one, but more relevantly, why the hell did PHP's devs think adding goto was a GOOD idea?! Seriously... I haven't yet found a situation in PHP where a goto would be the truly best answer.

I foresee this causing lots of bad mojo with PHP which it was doing so well at shaking off.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: PHP 5.3
« Reply #1, on November 12th, 2010, 12:26 AM »
goto was something I missed coming from Javascript but learned not to use it - and still won't. I don't want spaghetti code, thank you. Not anymore.
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: PHP 5.3
« Reply #2, on November 12th, 2010, 12:30 AM »
(see picture in above link :P)

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: PHP 5.3
« Reply #3, on November 12th, 2010, 12:35 AM »
LMAO @ the dinosaur

(Now I have a small headache :P)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: PHP 5.3
« Reply #4, on November 12th, 2010, 12:38 AM »
* Arantor does his best :D

In other news, the configuration I need/want is sufficiently special, that I'm going to be compiling PHP from source, I haven't done that in years so I feel somewhat nostalgic.

For those wondering what the hell I could be doing to need PHP home compiled, let me sum it up thus: the application stack isn't Apache <-> PHP <-> MySQL, but... nginx+NHPM <-> FastCGI <-> PHP <-> MongoDB

Yes, this is special in so many ways... and FUN :D Especially since each of those elements has to be compiled by hand for the magic configuration I need >_<

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: PHP 5.3
« Reply #5, on November 12th, 2010, 06:15 AM »
ugh sounds like work

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
“I will stand on my ground as an atheist until your god shows up...If my irreligious bothers you much, and if you think everything I do is heresy to your god I don't care. Heresy is for those who believe, I don't. So, it isn't heresy at all!


   Jack in, Wedge,
   EXECUTE!

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: PHP 5.3
« Reply #7, on November 12th, 2010, 09:18 AM »
Quote from live627 on November 12th, 2010, 06:15 AM
ugh sounds like work
Oh hell yeah, especially since the specific PHP configuration I want is PHP core + GD + ext/mongo and literally nothing else, don't want XML handling (there are about 7 extensions that are built seemingly by default that rely on libxml which wasn't installed... I hate crap like that)

The result will be worth it though once I get the app running.

Specifically it's a multi-user app that wouldn't look out of place on Google Apps - and where AJAX just isn't going to scale, so a Comet type methodology of long polling is what I'm after, except that you need to be able to idle on potentially thousands of connections simultaneously, which is where nginx comes in.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: PHP 5.3
« Reply #8, on November 12th, 2010, 10:09 AM »
Never used goto in Javascript... It's also frowned upon in Pascal, so I scarcely, if ever, used it in Delphi.
However, it seems like a safe enough statement given that it doesn't work outside of the current function's flow. Meaning that it's only to be used as a way to easily exit the current code block without having to add temp vars or conditional blocks or whatever.
As such, Wedge is 5.0+ so we won't be using that anyway, but it's nice to know that there's at least an alternative to temp vars, even if not very elegant.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: PHP 5.3
« Reply #9, on November 12th, 2010, 10:14 AM »
I still can't think of a solution that would really benefit from using goto versus well written non-goto code; the only example I can see that might be viable is the use of it for multiple breaks but even that doesn't strike me as massively easier to follow.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: PHP 5.3
« Reply #10, on November 12th, 2010, 10:36 AM »
I'm just saying that because a few days I was writing a non-loop code block where I thought, "fuck, if I could add a goto here, that would make my life easier..." (Of course, it didn't take more than a minute to find a workaround.)