Reputation: 2338
In SQL there is the LIKE
parameter that you can put in to have a wild card for values such as: LIKE %value%
. How would I be able to do that with, say, a PHP if statement?
$value = "value-";
$post = $_POST['retrievedVal'];
if($value.% == $post)
{
echo "true";
}
Upvotes: 0
Views: 1308
Reputation: 7772
As far as I know there is none, but don't worry there is a way to achieve the same with strpos()
just use the following if statement:
if(false !== strpos($post, $value)){
// you thing to do
}
beware strpos could return 0, so the explicit comparison is needed
Upvotes: 1