Skip to content

Instantly share code, notes, and snippets.

@euskadi31
Created March 26, 2011 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save euskadi31/887971 to your computer and use it in GitHub Desktop.
Save euskadi31/887971 to your computer and use it in GitHub Desktop.
test exception on basic php function
<?php
echo "Test exception" . PHP_EOL;
echo "Test : explode()";
try
{
$data = '1 2 3 4';
$v = explode('', $data);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
echo "Test : file_get_contents()";
try
{
$v = file_get_contents('http://free.fr', '/', null, 0, -1);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
echo "Test : file()";
try
{
$v = file('./test.php', 11111111);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
echo "Test : min()";
try
{
min(111);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
echo "Test : max()";
try
{
max(111);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
echo "Test : array_fill()";
try
{
$v = array_fill(5, 0, 1);
echo "\t[ no ]" . PHP_EOL;
}
catch(Exception $e)
{
echo "\t[ ok ]" . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment