Get $500+ of the best After Effects files, video templates and music for only $20!
Winners Announced: Free Copies of “Pro PHP and jQuery”

Winners Announced: Free Copies of “Pro PHP and jQuery”

Jason Lengstorf was nice enough to offer our community a handful of copies of his latest awesome book, Pro PHP and jQuery. Be sure to read his latest Nettuts+ tutorial, “Object-Oriented PHP for Beginners,” based on his book.


Winners Announced:

Congratulations to the following winners, who were randomly selected:

  • Jonathan Stuckey
  • Rick Blalock
  • Matt Vickers

Each of you will be contacted shortly about arranging your free copy. Thanks again to everyone who entered!

“This book is for intermediate programmers interested in building Ajax web applications using jQuery and PHP. Along with teaching some advanced PHP techniques, it will teach you how to take your dynamic applications to the next level by adding a JavaScript layer with jQuery.”

To enter for a chance to win a hardcopy version of the book, leave a comment with a PHP tip. It can be as simple or as long as you like. Just as long as it was something that helped you to learn PHP, that will automatically enter you! On Monday morning, we’ll choose the winners!


You can also purchase “Pro PHP and jQuery” here.

Tags: Freebie
Add Comment

Discussion 825 Comments

Comment Page 1 of 151 2 3 ... 15
  1. Rolfje says:

    Using classes instead of loss functions.

  2. Gary says:

    Debug, debug, debug!!!

    Seriously, the hardest part for me in learning PHP was getting good at debugging the language, since the errors messages are often times very cryptic.

  3. Don’t reinvent the wheel and remember that the fastest code is the code that never runs.

  4. Lee G. says:

    Use to out what is installed on your server and what version it is.

  5. Jakub says:

    If the whole file is PHP
    you don’t have to finish the file with “?>”

  6. Darkfortune says:

    Always keep your codes clean and clear,
    Its easier to update or maintain your code.

  7. Erik says:

    Try and make your classes as independent of the current project as possible. This way you’ll be able to reuse your code and save LOADS of time.

  8. Victor says:

    Hi,
    $variable = $variable + 1; is the same like $variable ++;

  9. David says:

    If your going to start writing PHP, know a good amount of coding first.

  10. PHP is a easy language (you don’t need to declare variables, for example).

    My tip is to always use the maximum level of error_handling and stick to it. Don’t let any WARNING or NOTICE slip. If you program like this, you learn faster and eventually make better and quicker code.

  11. Ryan Doss says:

    Comment Comment Comment…… comment your code and when you come back to a project three weeks later you won’t have to dig in for 2 hours before you know what you did!

    Saves time and helps keep things straight.

  12. Use instead of to increase the compatibility of your PHP scripts in different servers.

    • The filter of NETTUTS don’t left I use the PHP tags. Then, other tip:

      ” Separe your site in some PHP files, like menu.php, footer.php, content.php. Any alterations will be easy to be executed if you use this model. Don’t forget of create a PHP file that have a function that do the connection with the DataBase, and use this file in all the site, if you need change the DataBase login, for example, You only need change this file. “

  13. Josh says:

    One of the best tips I received about PHP that’s helped me debug several scripts is to make a small function in one of my helper files called darray.

    function darray($array, $exit = true)
    {
    echo ”;
    print_r($array);
    echo ”;
    if ($exit)
    {
    exit();
    }
    }

    That way whenever I’m using arrays, I can easily see what values are being passed in by just typing
    darray($arrayName);

  14. Corbacho says:

    Micro-Performance tip: Use single-quotes instead of double-quotes for strings if you don’t have variables-to-be-expanded in the string.
    $slower =”ohoh”;
    $better = ‘yeah’;

  15. achikochi says:

    Next level, PHP and jQuery can build huge application, this books will be helpfull.

  16. Teo Farro says:

    Don’t use spaces to format your code, use tabs. It will let your code run a little bit faster.

  17. Vinnie says:

    Structuring code to line up is a huge time saver :O

  18. Pedro says:

    Always remember to sanitize all form inputs, removing unwanted characters and html tags to help preventing injections (I know it is simple but I just started with php, I’m a AS3 developer).

    Thanks!

  19. Timmy says:

    When I have learned MVC, everything was better. I haven’t now a mess in code.

  20. Serhiy says:

    $array[’id’] around 10 times faster than $array[id]

  21. Sitebase says:

    Once you have learned the PHP basics and have some understanding of PHP functions and classes, try to do some projects with CakePHP, CodeIgniter or Zend Framework. Look at the code of the different frameworks and try to understand it. This has helped me a lot to become a better PHP programmer.

  22. Joe Casabona says:

    Best way to debug: Print statement.

    Also! I love conditional assignments: $foo= ($bar == 0) ? $foo++ : $foo–;

  23. Jason says:

    Using switch statements to match simple variables instead of if/if else.

  24. Arno says:

    ‘$variable’ is not your friend

  25. Leslie says:

    If you get this warning message, while running a php document:

    ‘Warning: Cannot modify header information – headers already sent by (output started at filename line no __) ‘

    This means that an error has occured in your page. This happens if there are any executable statements (Like echo) before a session variable or cookie. Find this statement, remove, and then refresh the page.

    Also, one space at the top of your page (line 1) will cause an error in your php. Remove this space, and refresh the page.

  26. Jonathon says:

    Not so much a php tip (although useful for php) is learn a framework. It takes additional time up front, but your productivity will increase dramatically in the long run as you won’t end up “reinventing the wheel”.

  27. Joffrey says:

    Easier control structure :

    if ($var== ‘test’) {
    $i++;
    }

    Can be replaced by :

    if ($var== ‘test’) $i++;

    Added much clarity to my work

  28. Cristian matos says:

    Use MVC and make it simple :)

  29. Martin says:

    Get to know to documentation, read other peoples code and do research, if you have a problem and cannot find an answer, ask but always post as much as possible if you expect help.

    Oh and ?: helped me out so much, I like If {…} else {…} but for something short and simple ?: if the way to go!!

  30. Luca DB says:

    That’s my usual footer :-)
    Copyright © 2000- website.com

    Of course edit 2000 according to the right starting year.

    • I assume you typed:

      Copyright © 2000- except with the correct PHP tags and quotations around Y, right?

      • God Bless.

        You’d think since they asked for PHP snippets that they’d at least allow them in comment blocks, right? This is killing me.

        Anyway – Luca DB’s tip is to use echo date(‘Y’); in your footer to always keep your copyright year current.

        If that doesn’t show up, I quit.

  31. Jeroen Offerijns says:

    Try to use single quotes (‘) instead of double quotes (“) because when using double quotes PHP tries to interpret variables.

    Wrong:
    $var = ‘The cat is $color’;

    Good:
    $var = ‘The cat is ‘ . $color;

  32. Alan says:

    Easily pull a URL to pieces using the parse_url() function:

    $url = parse_url(“http://net.tutsplus.com/articles/news/free-copies-of-pro-php-and-jquery?query=foo#bar”);
    print_r($url);

    Produces:

    Array
    (
    [scheme] => http
    [host] => net.tutsplus.com
    [path] => /articles/news/free-copies-of-pro-php-and-jquery
    [query] => query=foo
    [fragment] => bar
    )

  33. Didn’t know this till about a year ago – You can leave the trailing “?>” off at the end of your php files.

    The closing delimiter is optional, and removing it helps prevent unwanted white space at the end of files which can cause problems elsewhere.

  34. César Frick says:

    Keep the PHP separated of the HTML. It means a cleaner code and a a more efficient files organization in your proyect.

  35. kilinkis says:

    use “foreach” to go through arrays

  36. Rick Blalock says:

    Don’t write a complicated script to add commas to an integer. Just use number_format(). http://php.net/manual/en/function.number-format.php

  37. Matt B says:

    The first thing I learned with PHP way back in the day was using includes for header/footer/nav, but learning how to pull strings from URL’s to custom tailor content on each page was a biggie for me.

  38. Peeper says:

    Adding and subtracting dates with strtotime, example:

    - date(“Y-m-d H:i:s”,strtotime(“+1 months”));

    - date(“Y-m-d H:i:s”,strtotime(“-1 months”));

    Regards

  39. El Boletaire says:

    Use frameworks!! Like CakePHP, Zend or Drupal..!! It will bring you some headaches, but will remove a lot of them!

  40. Rafael says:

    I like the print statement for debugging; also to use a variable with the host name for images paths was an epiphany at the time.

  41. Rochester says:

    One really good tip is that

    is the same that

    (:

    []‘s
    Rochester

  42. Johan Jensen says:

    Use a great editor/IDE.
    For the Mac, you should use TextMate or Coda.

    It will help you a lot, when developing and debugging.

  43. Rob says:

    When referencing a URL-parsed variable (ie. ?foo=a) set an array of possible options for $foo and make sure your script first checks that the requested $foo is in fact; valid.

  44. Use a IDE with syntax-highlighting and code-hints! It’s worth the time you’ll spend to find the one you like – it will make you write your code faster and make it way easier to debug..!

    Remembering to turn on PHP-errors is quite helpful too!

  45. Javier says:

    Check php.net regularly. Theres hundreds of functions there waiting to be learned and used. It gets you to try some code, but more important it makes you to read code, a vital thing to be a good programmer.

  46. Matt says:

    Keep it simple, well-commented and organized.

  47. Miro says:

    Always use comments!

  48. Rochester says:

    [My code wasn't submitted]

    One really good tip is that

    >?=$var ?>

    is the same that
    >?php

    echo $var;

    ?>

    (:

    []‘s
    Rochester

  49. Paul Grock says:

    Use PDO instead of mysqli because it makes switching databases easier without a rewrite of code.

  50. Dan says:

    Working with CakePHP helped me to learn more about OO PHP and its structure. As a side tip: Aptana + PHP plugin is very nice and it’ll run on multiple platforms (Windows, OSX, Linux, etc.)

Comment Page 1 of 151 2 3 ... 15

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.