Page 1 of 1

Whats your reaction?

Posted: Sun Apr 22, 2007 7:20 pm
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?

Posted: Sun Apr 22, 2007 8:18 pm
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:

Posted: Sun Apr 22, 2007 8:29 pm
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 :)

Posted: Sun Apr 22, 2007 8:36 pm
by Jenk
My reaction is "What the hell is this thread about?"

Sorry.

Posted: Sun Apr 22, 2007 10:03 pm
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:

Posted: Sun Apr 22, 2007 10:48 pm
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 :)

Posted: Mon Apr 23, 2007 1:00 am
by Chris Corbyn
Jenk wrote:My reaction is "What the hell is this thread about?"

Sorry.
Here, here. Hmmm :?