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.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.sputnikweb.be Tim

    If you want to merge arrays and want to keep your array keys, don’t use array_merge but just use plus:

    $myArray = $array1 + $array2 + $array3;

  • http://thetechguia.wordpress.com Guilherme Vaz

    I used rand() function to show one random banner at a time on my site.

  • JV

    It’s just what I need!!!

  • http://www.digital-spoon.co.uk Matt

    I always now split my code up into manageable functions in a separate file and make the most of includes and requires to increase efficiency.

    Also avoid using loads of nested if else statements because it just gets complicated, use cases.

  • http://www.megablogsite.com dyrer
  • rightmost

    This book looks fantastic! I have just finished the PHP Live course over at Sitepoint and this would take it to the next step!

  • http://iwebpixels.com umaxim

    use mysql_real_escape_string to filter incoming information in mysql query.
    use addslashes to avoid simple mysql error with incoming information which have characters that need to be quoted. I really like your book so i will buy one.

  • slarek

    $objDirectoryFiles = new DirectoryIterator($path) ;

    foreach ($objDirectoryFiles as $file){
    if ($file->isFile()){
    if ((strripos($file,”.jpg”)==true) || (strripos($file,”.gif”)== true)) {
    array_push($arrFileName,’images/game/’.$file->getFileName());
    }
    }
    }

  • http://www.eface.lt vytautas

    I want to improve my skills of jquery and php, so i realy want to read this book.

  • http://www.zrixter.net Helven

    Helven needs the book!

  • monchode

    i really want to read this book.

  • http://gilbert.im/ Gilberto Ramos

    Don’t close your PHP documents with ?>

    The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.

  • http://daweb.hu KarDave

    You can use this php code for endless counting. It continues with the first item when reaching the last. You never have to reset the counter :)

    function endless($array, $item = 0){
    return $array[$item % sizeof($array)];
    }

  • qarp

    Just use this if you want to check a array, $_POST,$_GET,$_FILES and such which is nice to see what happens. Also can be implemented into classes and such…

    function smartDebugger($obj)
    {
    echo “”;
    print_r($obj);
    echo “”;
    }

  • http://www.buyeyeglasses.com Tamik

    on ajax calls to a php file – use jquery $.ajax function and in dataType set “JSON” ($.ajax({dataType:’json’,'url….). Then in the php file in when echoing result – you create an array(‘status’=>’success’, ‘message’=>MESSAGE YOU WANT TO RETURN ON AJAX CALL) then you do echo json_encode(ARRAY_THAT_YOU_JUST_CREATED); So now on ajax call the javascript file can parse this json returned string and check what was the status of request and if its “success” show the message of success , otherwise show Error message, which you can also pass from php.

  • Roy

    If you’re using regular expressions, then ereg_replace() and preg_replace() will be much faster than str_replace().

  • http://sheudesign.com Alan

    If you need to perform an arithmetic operation on a $_POST string variable, use intval($_POST['varName']) or (int)$_POST['varName']…

  • http://www.krossroadsdubai.com brendan

    I really want to read this book. the tutorial was fantastic

  • nders

    Looking at wordpress codings is a good way to start learning about php syntaxes. they are very quite and straight to the point.

  • Charlie Apps

    If for whatever reason you require the use of another framework like MooTools remember to use jQuery.noConflict(); to prevent conflicts in your scripts.

  • http://razvanjuravle.com Razvan Juravle

    // returns no. of minutes between given hours
    function calculMinutesFromHours($Time1, $Time2) {

    $totalMinutes = 0;
    $startTime = $Time1;
    $endTime = $Time2;

    $startMinute = substr($startTime, 3, 2);
    $endMinute = substr($endTime, 3, 2);
    $difHours = substr($endTime, 0, 2) – substr($startTime, 0, 2);

    if($difHours == 0) {
    $totalMinutes += abs(($endMinute-$startMinute));
    }
    if($difHours > 0) {
    $totalMinutes += ((60*$difHours)-$startMinute) + $endMinute;
    }
    return $totalMinutes;
    }

  • tb

    would love to pic up that book …

  • http://mattheintz.com Matt

    test early and test often!

  • julie

    This is from Robin Nixon’s book “PHP, MySQL & Javascript”, to sanitize user input from a form:

    function sanitizeString($var)
    {
    $var = stripslashes($var);
    $var = htmlentities($var);
    $var = strip_tags($var);
    return $var;
    }

    I’ve found it very useful.

  • http://www.stuckonjon.com Jonathan Stuckey

    For great code, almost never copy and paste.

  • http://creatia.us/ Ryan Doss

    Congrats… Way to throw your comment in there last minute Jonathan – Seems to have worked out lol!

  • http://www.dangermoose.co.uk flashmac

    lol – yepp the very last comment of 818 entries wins again. Mmmm, JW – check your rand() function will ya! ;)

  • http://belsemtech.com oussama larhmich

    Good Job , im not a Member yet But In the Futures :) Lol

  • Simon

    omg thats not right, can you explan how its randomly selected???

    that sux

  • Anthony

    function youWin($name) {
    if($name == ‘Anthony’) {
    return “win !”
    }
    else return “Loooose”;
    }

  • Michael

    Here 2 of my utility functions…

    /* PHP Email verification */

    if(!eregi(“^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email)) {
    print “Invalid Email [$email] \n”;
    }

    /* Javascript’s parseInt in php */

    function parseInt($string) {
    // return intval($string);
    if(preg_match(‘/(\d+)/’, $string, $array)) {
    return $array[1];
    } else {
    return 0;
    }
    }

    Love coding in jQuery and PHP – would love to get the book…

  • http://www.al7abib.com/vb al7abib

    muchas gracias a todo por todos

  • CollegeBookRenter

    I’m going to http://www.collegebookrenter.com for this book.

  • http://www.designereyewear.co.uk/ Designer Sunglasses

    I would also like to buy this book.