Archive

Archive for the ‘PHP’ Category

uniqid

// with prefix
echo uniqid(‘foo_’);
/* prints
foo_4bd67d6cd8b8f
*/

// with more entropy
echo uniqid(”,true);
/* prints
4bd67d6cd8b926.12135106
*/

// both
echo uniqid(‘bar_’,true);
/* prints
bar_4bd67da367b650.43684647
*/

using glob to find the file

// get all php files
$files = glob(‘*.php’);

print_r($files);
/* output looks like:
Array
(
[0] => phptest.php
[1] => pi.php
[2] => post_output.php
[3] => test.php
)
*/

HTML5 for different I.E

<!–[if lt IE 7]><script src=”http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js”></script><![endif]–>
<!–[if lt IE 8]><script src=”http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js”></script><![endif]–>
<!–[if lt IE 9]><script src=”http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js”></script><![endif]–>

http://code.google.com/p/ie7-js/

get the argument

// yes, the argument list can be empty
function foo() {

// returns an array of all passed arguments
$args = func_get_args();

foreach ($args as $k => $v) {
echo “arg”.($k+1).”: $v\n”;
}

}

foo();
/* prints nothing */

foo(‘hello’);
/* prints
arg1: hello
*/

foo(‘hello’, ‘world’, ‘again’);
/* prints
arg1: hello
arg2: world
arg3: again
*/

php tools website

http://www.fpdf.org

http://phppowerpoint.codeplex.com

http://phpexcel.codeplex.com

http://phpword.codeplex.com

http://tutorialzine.com/2009/11/hovering-gallery-css3-jquery/