http://rapidshare.com/files/355753489/Zend_PHP_5_Certification_Study_Guide_Oct_2006.pdf.html
MD5: 7CB357EB7F081FCCD2FEC5514A44EF52
copio algunas cosas que me parecieron interesantes..
<?php
function hello()
{
if (func_num_args() > 0)
{
$arg = func_get_arg(0); // The first argument is at position 0
echo "Hello $arg";
}
else
{
echo "Hello World";
}
}
hello("Reader"); // Displays "Hello Reader"
hello(); // Displays "Hello World"
?>
borrar un elemento de un Array
<?php
//Finally, an element can be deleted froman array by unsetting it:
$a = array (’a’ => NULL, ’b’ => 2);
unset ($a[’b’]);
echo in_array ($a, 2); // False
?>
ordenar desordenar Arrays
<?php
$cards = array (1, 2, 3, 4);
//sort ($cards);
shuffle ($cards);
var_dump ($cards);
//Since the shuffle() function randomizes the order of the elements of the array, the
//result of this script will be different every time—but here’s an example:
array(9) {
[0]=>
int(4)
[1]=>
int(1)
[2]=>
int(2)
[3]=>
int(3)
}
?>
Seguridad
<?php
$clean = array();
if (ctype_alpha($_POST[’username’]))
{
$clean[’username’] = $_POST[’username’];
}
if (ctype_alnum($_POST[’password’]))
{
$clean[’password’] = $_POST[’password’];
}
$colours = array(’Red’, ’Blue’, ’Yellow’, ’Green’);
if (in_array($_POST[’colour’], $colours))
{
$clean[’colour’] = $_POST[’colour’];
}
?>
<?php
if ( ctype_alnum($_REQUEST['email']) && ctype_alnum($_REQUEST['pass']) )
{
}
else
{
die("invalido.. <a href='index.php'>Volver</a>");
// header("Location: index.php");
}
?>