This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$foods = array( | |
array( | |
'id' => 4, | |
'name' => 'Banana', | |
'color' => 'Yellow', | |
), | |
array( | |
'id' => '5', | |
'name' => 'Apple', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mysqli = new mysqli('localhost', '#username', '#password', '#database'); | |
$handle = fopen('sqldump.sql', 'rb'); | |
if ($handle) { | |
while (!feof($handle)) { | |
// This assumes you don't have a row that is > 1MB (1000000) | |
// which is unlikely given the size of your DB | |
// Note that it has a DIRECT effect on your scripts memory | |
// usage. | |
$buffer = stream_get_line($handle, 1000000, ";\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <[email protected]> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Outputs a color (#000000) based Text input | |
* | |
* @param $text String of text | |
* @param $min_brightness Integer between 0 and 100 | |
* @param $spec Integer between 2-10, determines how unique each color will be | |
*/ | |
function genColorCodeFromText($text,$min_brightness=100,$spec=10) |