View RSS Feed

traq

  1. Heaps o' Fun

    yes, I'm still doing the tutorial. : )

    Did you know ...?

    PHP Code:
    <?php

    class alphaHeap extends SplHeap{
        public function 
    compare$a,$b ){
            return 
    strcmp$b,$a );
        }
    }

    $alpha = new alphaHeap;

    # IN put:
    $alpha->insert'cat' );       // C
    $alpha->insert'dog' );       // D
    $alpha->insert'boy' );       // B
    $alpha->insert'elephant' );  // E
    ...

    Updated 12-23-2012 at 09:09 PM by traq

    Categories
    PHP coding , Off beat topics
  2. Not My Type... : )

    Yes, the tutorial is still coming. It's big. It's in progress.

    I read this recently and was intrigued. Don't know if anyone else would care or not ...

    The author, nikic, does a great job summarizing the difficulties and potential benefits of type hinting, as well as giving a good explanation as to why PHP's implementation is incomplete. Personally, I look forward to being able to type-hint any type. It could save me a lot of code validating args, and I could ...

    Updated 12-01-2012 at 04:48 AM by traq

    Categories
    PHP coding , Off beat topics
  3. Before You Start: the basics, for PHP in particular and for programming in general

    I wanted to take a few moments to talk about some of "the basics" that are all-to-often glossed over...

    A Matter of Style

    In general, I find that most PHP programmers fall into one of three main programming styles:
    • procedural: a simple ordered set of instructions, nested if's/ else's, etc.
    • functional: functions are little code containers that you can call on when needed. You [usually] give them arguments, they [usually] return values to you.
    • object-oriented:
    ...

    Updated 12-17-2012 at 03:49 AM by traq

    Categories
    PHP coding
  4. Taking Control

    Last week, I wrote about taking a "PHP-first" approach to programming - program first, output last. But what should go first in your program?

    M-V-C
    You may have heard about something called "MVC" (Model-View-Controller). If not, here's your crash course:

    Model

    Your Model is all of the information needed/used by your program. [Hopefully], the Model is well-organized. Think of it in terms of note-taking: notes are easier to ...
  5. Every PHP Tutorial Is Wrong

    Many PHP tutorials begin with an introduction to the "basics" of the language: the <?php ?> tags, and usually the echo construct. For example, something like this:

    PHP Code:
    <html>
    <head>
        <title>My First PHP Page</title>
    </head>
    <body>
        <?php
            
    echo "Hello World!";
        
    ?>
    </body>
    </html>
    Before I blast this, I want to ...

    Updated 11-03-2012 at 02:27 AM by traq

    Categories
    PHP coding , Web Design issues