Article written by

31 Responses

Page 1 of 1
  1. Shareya Ahuja
    Shareya Ahuja at | | Reply

    Thanks for sharing these useful technique.
    I never think about these techniques.
    But i will do this.

  2. Ajaxmonk
    Ajaxmonk at | | Reply

    Just curios. What does all of your index pages look like?

  3. Prabhchahal21
    Prabhchahal21 at | | Reply

    i like it so much

  4. An alternative to Poor Man’s MVC in PHP · Squirrel Hacker

    […] Comments Mike on RE: Top 10 PHP Techniques That Will Save You Time and EffortSeanJA on Dynamic Images with PHPGreg on Dynamic Images with PHPSeanJA on RE: Top 10 PHP Techniques […]

  5. uberVU - social comments
    uberVU - social comments at |

    Social comments and analytics for this post…

    This post was mentioned on Twitter by Squirrel_Hacker: Blog: RE: Top 10 PHP Techniques That Will Save You Time and Effort http://bit.ly/btUsPP

  6. cx42net
    cx42net at | | Reply

    I was hoping his post was an easter egg, but regarding to his comments, it’s not.

    The sad point is that he’s sure to be right while is not.

    The main problem is that most of the tutorials you can find are the old ones from 10 years ago but so many changes was made since.

    For example, searching “php database” or something similar on google, and the first links you’ll find is about mysql_*.

    Hey ! Where is PDO ?! Where are the ORM indications ?

    How can a beginner find out about these if google is not helping him/her ?

  7. 網站製作學習誌 » [Web] 連結分享
    網站製作學習誌 » [Web] 連結分享 at |

    […] RE: Top 10 PHP Techniques That Will Save You Time and Effort […]

  8. zoe
    zoe at | | Reply

    Hah! Sean, when I first saw that XKCD comic, I thought of you.

  9. Aziz Light
    Aziz Light at | | Reply

    You stole this article from another blog…it was first released a couple days ago.

    It sucked before and still sucks now. Terrible article…

    1. Aziz Light
      Aziz Light at | | Reply

      actually, hasty answer, sorry about that. The article you supposedly “stole is actually the object of this post”. The original post sucked, this post is just pointless…

  10. Giorgio Sironi
    Giorgio Sironi at | | Reply

    For 3: debugging sucks, testing rocks. 🙂

  11. Macca
    Macca at | | Reply

    Nice!!

  12. Denny
    Denny at | | Reply

    Perhaps you could make a tutorial showing the right way to make an index file. While a lot of what the original post contained looked wrong to me, the stuff on index pages largely matches what I’ve been doing.

    1. Mike
      Mike at | | Reply

      I’m also curious as to a better or preferred method for the index page. I’ve done this in the past (not with $_REQUEST however). Aside from the potentially long switch (which wasn’t an issue the times I’ve used it) what other problems to you foresee with it?

      Nice clean up BTW.

  13. Paul
    Paul at | | Reply

    Thank you Thank you Thank you! I thought I was going crazy when I read that blog post… I agree with every one of your responses. It’s a shame how that post, while probably having good intentions, will corrupt a bunch of young php programmers.

  14. Marcus Kielly
    Marcus Kielly at | | Reply

    I have to say, I thought the same when I read it. Your comments about poor man’s MVC hit the nail on the head. To be fair, MVC might be a bit heavweight for a simple 5 page brochure site – in which case some of the advice is ok – but then again, if that was the case, why bring Smarty into play?
    Good post

  15. Kristopher
    Kristopher at | | Reply

    A puked a little in my mouth when I read his code.

  16. bgd
    bgd at | | Reply

    Wow, his comments on his own post are mind-boggling. He really seems clueless, doesn’t he? Good fun, though, in reading that…

  17. Wolfgang
    Wolfgang at | | Reply

    Well,

    your much more right than the guy/girl before!
    He/She did a lot of beginner mistakes.

    W.F.

  18. Vlad
    Vlad at | | Reply

    Thx for this … I barely contained myself from filling the guy’s comment form with curse words when i saw what he wrote.

  19. Craig Francis
    Craig Francis at | | Reply

    With your comment “The singleton pattern: you’re doing it wrong”.

    I have been wondring if this is always the case… take for example a “config” object:

    —-

    class config {

    private $store = array();

    final private function __construct() {
    // Being private prevents direct creation of object.
    }

    final private function __clone() {
    trigger_error(‘Clone of config object is not allowed.’, E_USER_ERROR);
    }

    final private static function get_instance() {
    static $instance = NULL;
    if (!$instance) {
    $instance = new config();
    }
    return $instance;
    }

    final public static function set($variable, $value = NULL) {
    $obj = config::get_instance();
    if (is_array($variable) && $value === NULL) {
    $obj->store = array_merge($obj->store, $variable);
    } else {
    $obj->store[$variable] = $value;
    }
    }

    final public static function get($variable, $default = NULL) {
    $obj = config::get_instance();
    if (isset($obj->store[$variable])) {
    return $obj->store[$variable];
    } else {
    return $default;
    }
    }

    }

    —-

    This allows the site to just use config::set(‘my_config’, ‘my_value’), and call the respective get method when required, without creating an instance of the config object all the time, or trying to keep one instance assigned to a variable which is always in scope (e.g. $this->config->get()).

    And I’ve been wondering if this is the right approach… I keep seeing comments that the singleton pattern is bad, but no-one really explores the issue well enough (in my opinion) to justify an outright ban… but likewise, if the singleton pattern is so bad, what is the alternative?

    One thing to keep in mind is that the less characters needed to access the config, the better, as its used enough times that it should be easy to use (from a typing point of view).

    1. Satya Prakash
      Satya Prakash at | | Reply

      This code seems useful.

  20. Are you open to learning from others? – Aaron McGowan

    […] Recently a blog post made by another “programmer” had caught the eye of another Brampton area developer as well as mine once it was shared. The post was absolutely horrible and contained some misdirected information specifically for a blog which focus is on helping you become a better programmer. Let me first denote that this blog post that I am writing (not the one I will be referring to) is not being written for discouragement to the other blogger. This post is simply to let him and others know that refusing to learn from others by being stubborn will not get you no where and for the fact of providing proper information regarding incorrectly misdirected information. The other Brampton area developer also has written a response to this incorrect blog posting titled “Top 10 PHP Techniques That Will Save You Time and Effort” which can be found here. […]

  21. Aaron McGowan
    Aaron McGowan at | | Reply

    Well said!

Leave a Reply