Welcome To Snipplr


Everyone's Recent PHP Snippets



  1. FAV

    php code example

    example of php code I worked on
    PHP 5 views posted 4 years ago by johnschneider
  2. FAV

    Add Login / Logout to Primary Menu

    Adds a Logout link to the end of your Primary Navigation is the user is logged in; else adds a Login link to the end of your Primary Navigation.
    PHP 8 views posted 4 years ago by entreprenerds
  3. FAV

    Simple PHP search with whole word extract and highlighted search word

    Simple PHP search with whole word extract and highlighted search word
    PHP 8 views posted 4 years ago by flatearthcomms
  4. FAV

    PHP - Doctrine - Left join ON condition AND other condition syntax in Doctrine

    In SQL I can get this by adding AND to the join LEFT JOIN installations i ON a.id = i.app AND i.page = :page This way I get the installation info for an app that has an installation on the page, but I get null values on the columns for app's that...
    PHP 2 views posted 4 years ago by satie83
  5. FAV

    Wordpress: Show all active plugins

    Show a list of active plugins on current site. I use it for diplaying in ManageWP and transfer to documentation
    PHP saved by 4 people 7 views posted 4 years ago by ellegaarddk
  6. FAV

    Secure Your Cakephp Website By Following These Simple Steps!

    <p>Follow these steps to secure your Cakephp Website:</p> <p>*Before you actually start using Security Component functionality, make sure you use $components = array (‘Security’, ‘Auth’) in the array so you can extend its functionality in...
    PHP 7 views posted 4 years ago by cakephpexpert
  7. FAV

    WordPress login screen

    Source: https://css-tricks.com/snippets/wordpress/customize-login-page/ Put them in your theme functions.php or make it a plugin.
    PHP 10 views posted 4 years ago by pauloc
  8. FAV

    Show a list of days between two dates

    Show a list of days between two dates, using native php DateTime functions
    PHP 4 views posted 4 years ago by snstro
  9. FAV

    Commonly used db functions for CodeIgniter

    This is a common model used to run some common functions like CRUD functions, get reference data from table, check for dependencies etc. So in other model, we don't have to add those function repeatedly
    PHP 8 views posted 4 years ago by invtr
  10. FAV

    2 Step use of WordPress 4 Customizer

    To use WordPress 4 Customizer API I'd need just to do 2 steps: define a data in the array, and call a custom registering function.
    PHP saved by 1 person 3 views posted 4 years ago by micklevin
  11. FAV

    Simple PDO Connection and select

    This is the basic code that you need to know to connect and list data with PDO. Don't use de old method (mysql_connect and mysqli_connect) to connect and interact with databases.
    PHP 11 views posted 4 years ago by snstro
  12. FAV

    Simple PHP cache technique

    This is a little code snippet that I use in almost every project that isn’t based on a popular CMS. Since its fairly expensive to hit the database on every page load, its a smart idea to cache the plain HTML markup of your page and serve that up. Y...
    PHP 5 views posted 4 years ago by a1ias
  13. FAV

    Send simple SMS with PHP

    Simple script to send SMS throught our HTTP API (Afilnet) with PHP. Steps: 1.- Register in Afilnet. http://www.afilnet.com/anunciante/registrar.php 2.- Login and get credits (10 free) to send SMS 3.- Use this script or html form example include in...
    PHP saved by 9 people 15 views posted 4 years ago by Afilnet
  14. FAV

    Search and returns the first results on a regex search

    Search and returns the first results on a regex search If we use parenthesized or subpattern, can return with $result_number
    PHP 1 views posted 4 years ago by jatubio
  15. FAV

    Create a regex expression with operator 'AND'

    Build a regex expression to all array elements are present in any order. Gets an array of strings (Sample: array("Access Denied","error","could not be retrieved") Return sample: '(?=.*Access Denied)(?=.*error)(?=.*could not be retrieved)
    PHP 1 views posted 4 years ago by jatubio
  16. FAV

    // Search multiple spaces with regex expressions

    Replaces spaces by '\s+' which means one or more spaces $string can be one string or one array of strings
    PHP 3 views posted 4 years ago by jatubio
  17. FAV

    translate non alphanumeric characters from file name into underscores

    Translate non alphanumeric characters into an underscore. Doesn't create double underscores if there's two spaces in a row. Also turns name to lowercase. Use with trim to avoid spaces at front or end.
    PHP 3 views posted 5 years ago by flatearthcomms
  18. FAV

    Find Weather Forecast from IP Address

    To retrieve the weather forecast for your location based only on your current IP, the full tutorial will have the following 5 sections (http://bit.ly/1A5Y651), that will: - Describe elements needed for weather forecast retrieval - Describe the weat...
    PHP 3 views posted 5 years ago by Hexahow
  19. FAV

    Sort & query multi-dimensional arrays by properties

    Sort & query arrays in PHP. Sort multi dimensional arrays by object properties and filter the array by specific criteria. Documentation: https://github.com/mattnicholson/DataList
    PHP saved by 16 people 7 views posted 5 years ago by mattnicholson
  20. FAV

    IP Address (IPv6) Lookup in Bulk Using PHP and MySQL Database

    The code below can be used to lookup IP address in bulk in return of geolocation information using PHP programming languages and MySQL database. In this tutorial, we use the IP2Location LITE database to lookup country of origin from the visitor's IP...
    PHP saved by 9 people 5 views posted 5 years ago by Hexahow
  21. FAV

    Remove duplicates from multi-dimensional array 2

    Works with any array
    PHP 3 views posted 5 years ago by a1ias
  22. FAV

    WebEdition Selectfeld Bundesländer Deutschland

    Select aus vorhandenen Daten des Datenbankobjektes
    PHP 3 views posted 5 years ago by ulfinger
  23. FAV

    HTML Table to plain text

    Use PHP's DOM parser to convert a table into plain text (including links with images)
    PHP 9 views posted 5 years ago by nigelnquande
  24. FAV

    HTML to Plain Text

    This function takes HTML input and converts it to plain text. It needs improvement so that it converts multiple blank lines to a single blank line and converts an &lt;a ... &gt; link to the markup equivalent (same for images). It should be rewritten...
    PHP 3 views posted 5 years ago by nigelnquande
  25. FAV

    jQuery UI autocomplete mit JSON und externer php-Seite als Quelle

    Bei Autocomplete aus größeren Datenbanken ist es sinnvoll, die Datenbankabfrage in eine separate php-Datei zu verlegen.
    PHP 3 views posted 5 years ago by ulfinger
  26. FAV

    Testimonials Magento extension

    Magento Testimonials extension add testimonials functinality to your store. Let everyone know what your customers think about your store. You can add photo, email, website url and rating to your testimonials. Show testimonials on sidebar or separa...
    PHP 3 views posted 5 years ago by steelgray9
  27. FAV

    Ultratabs magento extension

    Ultratabs extension will provide you with power to display, hide and change order of core Magento tabs on product details page. Such as: Description, Additional Information, Upsell Products List, Related Products List, Products Tags and Products Revi...
    PHP 0 views posted 5 years ago by steelgray9
  28. FAV

    Codeigniter-autocomplete-customjs

    codeigniter autocomplete
    PHP 8 views posted 5 years ago by shivrajgoa
  29. FAV

    Codeigniter-autocomplete-view

    codeigniter autocomplete
    PHP 7 views posted 5 years ago by shivrajgoa
  30. FAV

    Codeigniter-autocomplete-model

    codeigniter autocomplete
    PHP 5 views posted 5 years ago by shivrajgoa