addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Boston PHP Message Board Boston PHP Meetup Discussion Forum › Chapter 03: PHP Percolate! Season 6

Chapter 03: PHP Percolate! Season 6

Gene B.
babong
Boston, MA
Post #: 2,278
@David -- Nice work. Looks like you have the calculator down to a science.
Judy V.
user 52789062
Boston, MA
Post #: 12
Jim M.
user 65331472
Boston, MA
Post #: 9
Hi Gene,

Chapter 3 completed.

http://jmerrikin.com/...­

I am getting a bit curious about garbage collection in PHP and wondering if it uses the same principles and techniques as JavaScript?
Gene B.
babong
Boston, MA
Post #: 2,294
@Judy @Jim -- Nice work.

@Jim -- I've asked Larry Ullman to respond to your question.
Larry U.
user 57195822
Boston, MA
Post #: 22
Thanks for the question, Jim. The short answer is that PHP and JavaScript garbage collection are not that similar, although I wonder if there's something specific you have in mind. Garbage collection in JavaScript will vary from browser to browser. In JavaScript, when variables are no longer needed, they'll be put up for GC, but defining "no longer needed" is tricky (with or without closures), and so when the variable's memory is actually freed will vary. Hopefully all memory for all variables is freed when the browser window is closed.

With PHP, variables are put up for GC when they go out of scope. This is a bit easier to know in PHP, and isn't browser dependent. All the memory required is freed when the script terminates. But there's also GC when it comes to session data, which has it's own series of criteria.

I hope that helps and let me know if you have a more specific question that I didn't answer.
Jim M.
user 65331472
Boston, MA
Post #: 10
Thank you Larry, I really appreciate the thoughtful answer! I am always concerned about checking for memory leaks and performance in my JavaScript so I was wondering if there was a parallel in that regard. I totally hear you when it comes to "no longer needed" being tricky and in fact, that is usually one of the common culprits I find in my own code. Just trying to be as efficient a coder as possible.

Loving your book, learning lots!
Ken H.
Ken_H.
Boston, MA
Post #: 75
Hello Gene and fellow percolators -

I just got through chapter 3 - Follow the link to Chapter 3. I only posted the top-level page and it references the final form of the calculator.php script, since, as the book points out, there are no obvious differences to the website user.

I'll reiterate the mention of the errata in the final version of the calculator.php script as printed in the book - I found it by observation and review of the code, but as someone pointed out, it is listed in the official book errata. Not only is the code incorrect, but the results sample that is in the book correctly reflects the incorrect code result, that is, it's wrong. :) Just so anyone who was trying to check their answer by using the example in the book isn't flamboozled by that.... since once you fix the code, the book example will no longer match your output.

Thanks - and have a great week everyone!
Ken
Gene B.
babong
Boston, MA
Post #: 2,326
@Ken -- Nice work. Thanks for catching this detail.
@Percolators -- The errata for Chapter 3 that Ken refers to is identified here.
James B.
user 13861667
Spring City, PA
Post #: 113
Chapter 3 complete: My Work
Gene B.
babong
Boston, MA
Post #: 2,330
@James -- Good job.
Powered by mvnForum

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy