Skip to content

Instantly share code, notes, and snippets.

@mathewka
mathewka / Installation of composer
Created April 15, 2014 05:58
Installation of composer
Installation of composer
refer the URL (http://getcomposer.org/doc/00-intro.md)
Installation - Windows#
Using the Installer#
This is the easiest way to get Composer set up on your machine.
@mathewka
mathewka / uasort.php
Created April 15, 2014 05:59
php uasort
function compare_array($no_of_incidents, $no_of_incidents) {
$incident_count_first = intval($no_of_incidents['1']);
$incident_count_next = intval($no_of_incidents['1']);
if ($incident_count_first == $incident_count_next) {
return 0;
}
return ($incident_count_first > $incident_count_next) ? -1 : 1;
}
@mathewka
mathewka / website-content-reader.php
Created April 15, 2014 06:31
Data Scraping - Read data from another website.
<?php
class WebContentReader{
public $global_url;
function __construct(){
$this->global_url = array();
// Create connection
$con=mysqli_connect("localhost","root","","dbname");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
@mathewka
mathewka / watermark-image.php
Created April 15, 2014 06:32
Create water mark image
<?php
/*
* PHP function to image-watermark an image
* http://salman-w.blogspot.com/2008/11/watermark-your-images-with-another.html
*
* Writes the given watermark image on the specified image
* and saves the result as another image
*/
define('WATERMARK_OVERLAY_IMAGE', 'watermark.png');