Tutorials, Tips and Resources for PHP

The TTR is a series of posts which we will try to do each week on a subject like PHP, JS, CSS and or HTML. This will cover 10 to 20 links in each category; tutorials, tips and resources. If you want to suggest some please just contact us or leave a comment!

Tutorials

  • Build A Photo Gallery Using CakePHP And Flickr.

    Johnathan Snook explains how to build a photo gallery using CakePHP and Flickr. He uses Javascript for lightbox effects too. If you want a simple and fast gallery on your webpages then, this is what you need.

  • Uploading Videos To Youtube

    Carl Evans takes you through the process to upload videos to youtube with the help of youtube, google API and zend framework.

  • Posting Form Data with cURL

    Forms can be submitted to other websites with execution of this simple script explained by Third_Degree. I can already imagine a lot of automation.

  • Store Images in MySQL with PHP

    vBulletin, a popular forum softwares uses MySQL to store images. Jordan (Author) illustrates advantages/disadvantages and the the complete process of using PHP to store images.

  • Getting Started with OpenID and PHP

    OpenID is a way to minimize the process of registering at different websites. The author explains the use of OpenID, the benefits and the steps to build login forms powered by OpenID.

  • Drawing with PHP / Drawing Graphs with PHP

    GD Library is a poweful image manipulation library. The author explains how to dynamically draw images / draw graphics with the power of PHP arrays and GD library.

  • Display Images Stored in MySQL

    You had already stored images in MySQL database with the help of above tutorial now, Jaan explains how to display those images on webpages.

  • PayPal Payments Using IPN

    Learn how to accept PayPal Payments using the easy-to-use PayPal IPN.

  • Generate PDFs with PHP

    Icarus from Sitepoint explains how to use PHP to generate PDFs. A popular example of this will be webhosting billing systems which generates printable PDF version of the invoices.

  • Understanding the Life of a Session

    Adam from TalkPHP elaborates the security issues involved with using sessions. A must-read for a beginner.

Tips

  1. Single-quotes uses period (.) for concatenation with variables which takes less processing time as compared to variables which are blended in double-quotes.
  2. A IRC channel exists for PHP support #php on freenode. Don’t ask to ask.
  3. cURL library is faster than fopen function for opening web-pages.
  4. substr() can be used to truncate long text.
    substr('This is a very long line which will be truncated to 10 characters', 0 , 10');
  5. ucwords() can be used to titleize a text. It capitalizes the first character of every word.
    ucwords('please make me a title');
    output: Please Make Me A Title
  6. money_format function returns formatted version of the number relevant to localization.
    setlocale(LC_MONETARY, 'en_US'); // Localization USA
    echo money_format('%i', '100') ; // Print the number with the currency code wrapped before number.
    // Output: USD 100
  7. array_sum function can be used to sum the numbers in an array. -1 loop.
    $cost = array(50, 100, 35.45, 500, 485, 68.75, 4298, 237823, 5.4, 574); // Make sure the numbers are integer
    $final_cost =  array_sum($cost); // Sum the numbers in $cost
    echo $final_cost; // Output final cost
  8. There are default functions to validate datatypes.
  9. is_array
  10. is_int
  11. is_bool
  12. is_object
  13. and many more..
  14. Xdebug generates formatted version of PHP warnings,errors,notices and var_dump.
  15. Comment your code in all circumstances. Comment your loops and control structures.
    /**
     * Validate Form
     */
    if(count($_POST) == 5) { // The form is completely filled in..
    echo 'Thank you for your message';
    }
    else { // The form has not been completely filled in..
     redirect(''); // Redirect to form again
    exit(); // Exit the webpage, no further processing.
    }

Resources

  • PHP Desktop Programming

    Want to develop desktop programs with PHP? Use PHP-GTK. PHP-GTK Version 2.0.1 was released few months ago.

  • Quick Access to Functions Documentation with Shortwaveapp

    Add shortwaveapp bookmarklet to your browser and use “php functionname” on the javascript popup to quickly access the function documentation.

  • PHP Editors Review

    Popular text editors reviewed by php-editors.com team.

  • PHP Forum

    A home for PHP developers. TalkPHP contains articles written by experienced developers, php general discussions and php help sections with a pinch of humour.

  • PHP : Home

    PHP.net is the best resource for all-things-php. I recommend everyone to check php official documentation first because they’re clearly written with comments from experienced developers providing variety of solutions.

  • MySQL : Home

    Just like PHP Home, MySQL Home has extremely well importance. It has an extensive documentation with all kinds of technicial details required by any developer. Kudos amd thanks to the documentation team.

  • PHPMailer

    PHPMailer provides an alternative route to php mail function with powerful functions such as attachments, multiple contacts, smtp options, html/text format content for the email and etc. Do checkout!

  • PHP Frameworks Comparison

    PHP Frameworks are a hot thing in the world of PHP. There are a different kind of frameworks with different kind of working style. The chart just highlights the features and doesn’t indicate which is the best or which is the worst framework.

  • PHP Classes

    PHP Classes has every kind of classes available for free download from AJAX to XML classes. Do check it out.

  • Regexlib

    Regexlib is a library of regular expression with common expressions for emails, domains, ip, phone numbers and etc.. It’s a time-saver resource.