if any comma in string in php 1

if any comma in string in php

php function strpos return position of string if it's not false or -1 then your string contain character.

$searchForValue = ',';
$stringValue = '115,251';

if( strpos($stringValue, $searchForValue) !== false ) {
     echo "Found";

Here is what the above code is Doing:
1. We’re using the strpos() function to search for the character we want to find.
2. We’re using the !== operator to check if the character was found.
3. If the character was found, we’re printing out a message.

Similar Posts