Mac
New Member
- Feb 9, 2011
- 111
- 2
PHP:
<?php
function contains( $a, $b, $c ) {
if(isset($a, $b, $c)):
if( $c == '1' ):
return preg_match( "/" . $a . "/", $b );
else:
return preg_match( "/" . $a . "/i", $b );
endif;
else:
throw new exception('Required fields for this function are not set!');
endif;
}
echo ( contains( $_GET['p1'], $_GET['p2'], $_GET['case'] ) ? "Yes!" : "No!" );
?>
Credits to me for the base and m0nsta. for editing!