Sunday, August 14, 2011

Sunday 8.14.11


<?php
$textblock = 'see spot run, run spot run. See spot roll, roll spot roll!';
echo wordwrap($textblock, 20, "
");
?>




<?php
//define a maximum length for the data field.
define("MAXLENGTH", 10);
if(strlen('Hello World!') > MAXLENGTH){
echo "the field you have entered can be only " . MAXLENGTH . " characters in length.";
} else
{
echo "length is correct";
//insert the field into the database
}
?>




<?php
$stringone = 'something';
$stringtwo = 'something';
if($stringone == $stringtwo){
echo "These two strings are the same!";
}
?>





<?php
if(strncmp("something", "some", 4) == 0){
echo "A correct match!";
}

if(strncasecmp("SOMEthing", "some", 4) == 0){
echo "A correct match!";
}
?>

No comments: