Useful PHP Snippets

If you are looking for useful PHP snippets, here’s list compiled from my previous posts. I am sure this list will come in handy for you in your PHP projects.

PHP $_GET & $_POST VariablesPHP MySqli Basic usage (select, insert & update)Send PHP mail with AttachmentCheck CURL is enabled in PHPGenerate Random String Using PHPDetect Ajax Request using PHPAdd Comments in PHPWorking with PHP SessionsSet Cookies Get Cookies Delete Cookies with PHPCreating PDF Files using PHP FPDF libraryHandle JSON data using PHPUpload a file with PHPResize Multiple Images in a Folder using PHPOutput Text on Image using PHPCache Dynamic Pages with PHPDate formats in PHPPHP Explode and ImplodeRedirect user to new URL with PHPRandomized quote display PHPPHP Pagination FunctionMicrosoft Access using PHP PDOReturn Currency Symbols using PHPForce download any file using PHPMake Plain text URLs clickable linksShorten URLs using Bit.ly API (PHP)Get domain name from email using PHPBlock Disposable email domains (PHP)Create New Widget in WordPressUseful PHP functions Copy/PasteBasic Adsense Plugin for WordPressOutput Text on Image using PHP imagettfbboxAmazon SNS Subscription verification with PHPGrab Picture From Remote URLUsing WordPress Custom FieldsFixing Image Orientation using its Exif dataCreating Valid RSS feed Using PHP DOMCreating RSS feed Using PHP SimpleXMLGet Percentage using PHPCreate Image Gallery from a DirectoryImage Upload and Re-size with PHPWatermark an uploaded Image with PHPCapture Array Values from Dynamic input Fields Combine JS or CSS files with PHPPHP $_GET & $_POST Variables10 Exceptionally Reliable PHP Snippets for DevelopersBackup MySQL Database Using PHP MySqliBackup Website and Database using PHP exec()
  1. Hi Saran,
    Thanks a lot for shareing.
    So helpful.

     Reply
  2. thank you so much for this code

     Reply
  3. thank you so much for this code

     Reply
  4. Listing all your php tutorials in this proper manner is really good. :)

     Reply
  5. thank u so much for this code

     Reply
  6. Hi, your website is cool and educative. I would like if u could get time to make a tutorial on a php script that search the entire web pages for a match in a search bar. And should be able to work on the localhost without internet connection :-D
    Thanks hope to hear from u.

     Reply
  7. Well, what i could say is you are super awesome! Keep on the good work~

     Reply
  8. thanks a lot.. i learned a lot from your webs5te..
    more blessings.. thak you soooo much.. :D

     Reply
  9. To Sanwebe team,
    thanks a lot.. i learned a lot from your tutorials..
    more blessings.. thak you soooo much.. :D

     Reply
  10. Shahbaz Ahmed Bhatti

    Dear Sanwebe team,
    Bunch of thanks all o fyou people, for putting good tutorials related to php. this website is very nice and good and helpful

    cheeeers

     Reply
  11. Hello! Please I would want to be able allow users select options from a list of selections as many times as possible using PHP, how do i achieve that? Below is a form for better description of what i desire to do

    You can enter your subjects as many times as possible

    English
    Mathematics
    Physics
    Chemistry
    Biology

    A
    B
    C

    2012
    2011
    2010

    Each time a user makes a complete entry, “Subject”-“Grade”-“Year”, the selection elements should re- appear to enable the user be able to make another selection as many times as possible, each time the user is doing this, the SELECTED should be visible for all to view.

     Reply
Message Type : Question Comment ?
  • Question : Can include code, jsFiddle, codePen etc using Markdown Syntax.
  • Comment : Short comments and questions.