SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 29 of 29
  1. #26
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We've had our books licensed by companies who have translated them to German before.
    Yep, I've seen some advertisement in a computer magazine.

  2. #27
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, congratulations Harry and Sitepoint!!

    Just received my copies today. Alreadys skimming and finding some nuggets that will be useful (as expected ). Have a friend asking for help in locating a php hosting service and the checklist looks really good.

    Couple of quick things:

    In the section on LazyLoading (II p. 276) you mention the problem of being harder to see what the requirements are if the requires are burried in the class. Also, PHP Documentor does not parse these includes in your source code dodumentation!! I have found a solution that looks like this:
    PHP Code:
    if (false) { //here for php documentor
      /**
        * load the bar class
        * 
        * this is implemented as a lazy load and will only be parsed if the
        *  foo::loadbar() method is used
        */
      
    require_once 'bar.php';
    }
    class 
    foo
    {
      function 
    loadbar() {
      if (!
    class_exists('bar')) require_once 'bar.php';
      }

    Also, in regards to the comment
    Quote Originally Posted by II pg. 277
    Note that copying variables uses up memory for each copy.
    I was under the understanding that PHP uses reference counting and only really makes the copy of the variable on change. Does anyone know if this is this not the case?

    @HarryF: would you like to see comments regarding the book continue here or do you prefer some other medium?
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #28
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Handy tip on the includes. Looking forward to autoload in PHP5.

    Guess the point on variables in a truism. Rasmus Lehrdorf makes a general comment here: http://www.lerdorf.com/tips.pdf on the page after the title.

    That said, looking at http://www.php.net/manual/en/zend.variables.php, it looks like the answer is "it depends";

    ZEND_SET_SYMBOL takes care of introducing the new variable to Zend's symbol table. This macro checks whether the value already exists in the symbol table and converts the new symbol to a reference if so (with automatic deallocation of the old zval container). This is the preferred method if speed is not a crucial issue and you'd like to keep memory usage low.

    ...

    If you need to optimize for speed and don't care about optimal memory usage, you can omit the check for an existing variable with the same value and instead force insertion into the symbol table by using zend_hash_update()
    I'm no expert on PHP internals so can't say which is a preferred approach.

    @HarryF: would you like to see comments regarding the book continue here or do you prefer some other medium?
    Whatever you prefer. Put here, it saves the same question coming up twice. Thanks for taking time (and glad there's some nuggets in the book you can use, as I guess most of it is below where you're at).

  4. #29
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by HarryF
    Looking forward to autoload in PHP5.
    Does my post #6 in this thread seem like an accurate take on __autoload()?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •