IPhone detection
Wednesday, February 17th, 2010if (stristr($_SERVER['HTTP_USER_AGENT'], ‘iPhone’))
{
// redirect to an iphone version
}
if (stristr($_SERVER['HTTP_USER_AGENT'], ‘iPhone’))
{
// redirect to an iphone version
}
$match = ‘/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/’;
preg_match($match, $email);
{
return 'hello world';
// or echo
}
?>
Then add [helloworld] to the post.
This example shows how to use a specific font.
<?php
header("Content-type: image/gif");
$image = imagecreate( 500, 250 );
$blue = imagecolorallocate($image, 0,0,255 );
$font = "ARIALBD.TTF";
imageTTFtext( $image, 50, 0, 20, 100, $blue, $font, www.getphp.net );
imagegif($image);
?>
I was asked how to get the version of PHP , this was due to the minimum requirements of a script stating PHP 5 and a user wanted to know how he could check what his host supplied.
This is the simplest version, save as version.php, upload and then open it in your web browser.
<?php
echo phpversion();
?>
On my XAMPP installation it displayed 5.2.6