Whats your reaction?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Whats your reaction?

Post by alex.barylski »

Code: Select all

xml_parse_into_struct(xml_parser_create(), $simple, $vals, $index);
Notice the absence of the following function:

http://ca3.php.net/manual/en/function.x ... r-free.php

Technically I believe this is fine (as we all know PHP has a GC built in) and if memory serves me correct won't actually offer a performance increase. I've since forgotten how PHP handles memory.

I don't think memory is released (at least at the OS level) but rather marked as free for later use if required. So long as there wasn't any intensive memory requirements after the above parsing no performance loss should be experienced. In fact calling the function is probably the performance killer if your that anal - which I usually am. :P

Anyways, the point is, I've used the above (despite making me feel uneasy) and would prefer a single line as opposed to three.

What is your reaction to the above if you seen that code? Would you add the cleanup just cuz it's proper practice?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I tend to shy away from one liners, just because it makes code much less readable. We're not using 640x400 screens anymore, I think we can afford a little more whitespace :wink:
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

It's not really a one liner issue for me or whitespace. It's that three lines are the same (technically) as one and in this case, the one line is just as legible and the three lines, at least to me it is.

However, it was opinion I was after and it is opinion that I got, despite being different from my own :P

Thanks man :)
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

My reaction is "What the hell is this thread about?"

Sorry.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Hockey wrote:It's that three lines are the same (technically) as one and in this case, the one line is just as legible and the three lines
Isn't that in essence exactly what I just said? Readability. Your right though, readability is in the eye of the beholder.
Jenk wrote:My reaction is "What the hell is this thread about?"

Sorry.
Mine too. :wink:
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Jenk wrote:My reaction is "What the hell is this thread about?"

Sorry.
Haha :)

Nothing really...sometimes when I think to much I find myself basically battling myself for what the right or wrong way or best or ideal solution would be, so in cases like these (because I work from my room and no one around me is tech) I turn to a message forum in hopes or getting an opinion and possibly assist me in coming to a conclusion.

My apologies if I've wasted your time - as I see how that could the case (it's not helpful to the community but more me).

Cheers :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Jenk wrote:My reaction is "What the hell is this thread about?"

Sorry.
Here, here. Hmmm :?
Post Reply