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 | |
$file = 'c:\\xampplite\\htdocs\\index.php'; | |
$max = 1000000; | |
?> | |
<p>Command: <strong>$ext = end(explode('.', $file));</strong></p> | |
<?php | |
// Start TIMER | |
$stimer = explode( ' ', microtime() ); | |
$stimer = $stimer[1] + $stimer[0]; | |
?> |
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 | |
$max = 100; | |
$table = 'mytable'; | |
$limit = $max; | |
$mysql = mysql_connect('localhost', 'root', ''); | |
mysql_query('USE test'); | |
?> | |
<h2>Order By Rand()</h2> | |
<?php | |
// Start TIMER |
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 | |
function arrayToObject($array){ | |
return is_array($array) ? (object)array_map('arrayToObject', $array) : $array; | |
} | |
// Start with a multi-dimensional associative array | |
$array = array('software' => array( | |
'apache' => array('version' => '2.2.14', 'website' => 'http://www.apache.org'), | |
'php' => array('version' => '5.3.1', 'website' => 'http://www.php.net'), |
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 | |
// Calculate distance between 2 sets of longitude/latitude coordinates | |
// Takes two sets of coordinates in decimal longitude and latitude format and returns the distance in miles. | |
// php, distance, coordinates, longitude, latitude | |
// Oelwein, IA | |
$lat1 = 42.6733171; | |
$lon1 = -91.9135036; | |
// Independence, IA |
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 | |
function random_string($length, $max = false) | |
{ | |
if (is_int($max) && $max > $length) { | |
$length = mt_rand($length, $max); | |
} | |
$output = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$which = mt_rand(0, 2); |
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 | |
// Define an strong encryption key to use with MCRYPT | |
// Note: The same encryption key used to encrypt the data must be used to decrypt the data correctly | |
define('ENCRYPTION_KEY', 'ayf9y0fuY3WN27bha45c65g5pw8FEep7'); | |
// Encrypt Function | |
function mc_encrypt($encrypt, $mc_key){ | |
$encrypt = serialize($encrypt); | |
$passcrypt = trim(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mc_key, trim($encrypt), | |
MCRYPT_MODE_ECB)); |
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 | |
/* | |
| | |
| Put this file (MY_Router.php) inside /application/core (CI2) | |
| Remember that this will effect all segments, not only module, controller and method. | |
| | |
| Alternative to this extend is to add each segment to application/config/routes.php | |
| $route['this-is-a-module-or-controler'] = 'this_is_a_module_or_controller'; | |
| | |
| As you can see the extend method would be easier to use. You can choose to make |
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 | |
function randomPassword( $len = 10, $ucfirst = true, $spchar = true ){ | |
/* Programmed by Christian Haensel | |
* christian@chftp.com | |
* http://www.chftp.com | |
* | |
* Exclusively published on weberdev.com. | |
* If you like my scripts, please let me know or link to me. | |
* You may copy, redistribute, change and alter my scripts as | |
* long as this information remains intact. |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
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 | |
/** | |
* Turn all URLs in clickable links. | |
* | |
* @param string $value | |
* @param array $protocols http/https, ftp, mail, twitter | |
* @param array $attributes | |
* @param string $mode normal or all | |
* @return string | |
*/ |