<?php
$string='hello world';
if(preg_match("/hel/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted found
<?php
$string='hello world';
if(preg_match("/z/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted not found
<?php
$string='hello world';
$searchstring='hel';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted found
<?php
$string='hello world';
$searchstring='z';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted not found
<?php
$string='hello world';
$searchstring='hello';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output : word or characted found
$string='hello world';
if(preg_match("/hel/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted found
<?php
$string='hello world';
if(preg_match("/z/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted not found
<?php
$string='hello world';
$searchstring='hel';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted found
<?php
$string='hello world';
$searchstring='z';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output :word or characted not found
<?php
$string='hello world';
$searchstring='hello';
if(preg_match("/$searchstring/",$string))
{
echo 'word or characted found';
}
else
{ echo 'word or characted not found';
}
?>
output : word or characted found