PHP Strpos
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}
Grepper
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}
return strval($integer);
$number = 11;
// This
echo strval($number);
// Or This
echo (String) $number;
// Output
// "11"
// "11"
<?php
$var_name = 32.360;
// prints the value of above variable
// as a string
echo strval($var_name);
<?php
class StrValTest
{
public function __toString()
{
return __CLASS__;
}
}
// Prints 'StrValTest'
echo strval(new StrValTest);
?>
__toString() & {$this->name}