Starting late with coding

Yes, I know, I just prefer using all lowercase and underscores.

For example, if I wrote Kier's code, this is what it would look like:

PHP:
public function get_news_feed ( array $conditions = array ( ), $fetcholderthanid = 0, array $viewinguser = NULL )
{
    $this->standardize_viewing_user_reference ( $viewinguser );

    if ( $fetcholderthanid )
    {
        $conditions['news_feed_id'] = array ( '<', $fetcholderthanid );
    }

    $newsfeed = $this->get_news_feed_items ( $conditions, $viewinguser['user_id'] );

    $newsfeed = $this->fill_out_news_feed_items ( $newsfeed, $viewinguser );
    $this->_cache_handlers_for_news_feed ( $newsfeed );

    return array (
        'newsfeed'            => $newsfeed,
        'newsfeedhandlers'    => $this->_handler_cache,
        'oldestitemid'        => $this->get_oldest_news_feed_id_from_array ( $newsfeed ),
        'feedends'            => ( sizeof ( $newsfeed ) == 0 ) // permissions make this hard to calculate
    );
}

I have weird standards, I know (especially the spaces... I dunno, they just help me read it better). :p

A standard is a standard as long as you continue to use it always.
 
I:

braces on new line, space between function and opening parens, lowercase, underscores, etc.

I also can't stand: &&, ||, or as (in foreach) :p It HAS to be AND, OR, or AS. If not, I go crazy.

PHP:
function spf_clean($value)
{
    if (is_array($value))
    {
        foreach ($value AS $key => $val)
        {
            if (is_string($val))
            {
                $value["$key"] = trim(stripslashes($val));
            }
            else if (is_array($val))
            {
                $value["$key"] = spf_clean($value["$key"]);
            }
        }
        return $value;
    }
    return trim(stripslashes($value));
}
 
Got the book today complete with the floppie. :)

joyofc.webp
Exerpt from this book:

A Word to the Wise

Trying to learn how to write C programs simply by reading a book about it is like trying to learn how to play a guitar simply by watching music videos - it's completely silly. We can't emphasize enough that the only way to really learn a programming language is to write programs in it - lots and lots of programs!
 
I:

braces on new line, space between function and opening parens, lowercase, underscores, etc.

I also can't stand: &&, ||, or as (in foreach) :p It HAS to be AND, OR, or AS. If not, I go crazy.
We differ on the && part, however I cannot stand using lowercase AS. And it pisses everybody else I work with off because their IDE's don't highlight uppercase AS properly. :P
 
Nice.

I remember reading that donkeys years ago working into the night getting things working and learning, then from there building on the knowledge with Java & scripting languages. End result being you understand what is happening from a very high level function call, all the way to the bits hitting the disk or being passed to a gpx card.
 
Thank you, guys. Looks like for me the best route to take is to buy a couple of good books to understand the basics and move from there to more challenging assignments.

If no one has mentioned it yet Kevin Yanks "Build Your Own Database Driven Web Site Using PHP & MySQL"

Available here -> http://www.sitepoint.com/books/phpmysql4/

From beginning to about medium level, well worth the investment as things are explained in easy to follow English.

 
I remember reading that donkeys years ago working into the night getting things working and learning, then from there building on the knowledge with Java & scripting languages. End result being you understand what is happening from a very high level function call, all the way to the bits hitting the disk or being passed to a gpx card.
Looks like this one is gonna be a HQ foundation builder. Considering todays realities what route should I take after I am done with this book? Straight to PHP and Javascript?
 
Looks like this one is gonna be a HQ foundation builder. Considering todays realities what route should I take after I am done with this book? Straight to PHP and Javascript?

Functional PHP, then check out OO before OO-PHP, then js and html5
 
I highly recommend PHP Objects, Patterns, and Practice by Matt Zandstra; if you are familiar with procedural PHP and not really sure what this whole OO uprising is about, this book will shed light on some advanced OO techniques with examples in PHP specifically.

Apparently, there is a new 3rd edition with coverage on PHP 5.3 which I may purchase. (I bought the 1st edition years ago.)
 
I highly recommend PHP Objects, Patterns, and Practice by Matt Zandstra; if you are familiar with procedural PHP and not really sure what this whole OO uprising is about, this book will shed light on some advanced OO techniques with examples in PHP specifically.

Apparently, there is a new 3rd edition with coverage on PHP 5.3 which I may purchase. (I bought the 1st edition years ago.)
While important to learn, PHP 5.3 will take a while to get the usage 5.2 is atm... especially w/web hosts. For the most part scripts will run just fine on 5.3, but there are going to be those that cause people & hosts headaches.
 
The difference between the languages and hosting specifics aren't really relevant here as the individual is learning programming from the ground up, attempting to confuse the issue with any/advanced OO or versions isn't going to be helpful, this is walking not running.
 
I:

braces on new line, space between function and opening parens, lowercase, underscores, etc.

I also can't stand: &&, ||, or as (in foreach) :p It HAS to be AND, OR, or AS. If not, I go crazy.

PHP:
function spf_clean($value)
{
    if (is_array($value))
    {
        foreach ($value AS $key => $val)
        {
            if (is_string($val))
            {
                $value["$key"] = trim(stripslashes($val));
            }
            else if (is_array($val))
            {
                $value["$key"] = spf_clean($value["$key"]);
            }
        }
        return $value;
    }
    return trim(stripslashes($value));
}

To each his own.

The bitwise operators are & and | so i use the && and || to ensure consistency.
 
Don't forget to have a blank book in real life with a pen handy as that's the best way to capture your ideas.
I understood the value of "writing down" thoughts when I first started learning English. For an adult it wasn't easy, but I am almost there.

Thanks, guys. I am out of here for a month or so.
 
Top Bottom