Login
Remember
Register
PHPOnlineSupport
Questions
Unanswered
Tags
Categories
Ask a Question
Ask a Question
php find exact match in string?
0
votes
7.6k
views
asked
Mar 5, 2018
in
General
by
mithun
(
740
points)
php find exact match in string. not just contain words?
ie check if exact "India" inside a string, should not consider "Indiana" or something similiar.
How would you do that?
compare
string
php
contains
Your comment on this question:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
1
Answer
0
votes
answered
Mar 5, 2018
by
Jonat
Use the regex
$wildcard = "india";
$string = 'Bala Ji Karnal, India';
if (preg_match("/\b".$wildcard."\b/i", $string))
{
echo "Got it!";
}
else
{
echo "No match found!";
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Related questions
+2
votes
2
answers
9.2k
views
Replace all last occurrence of characters of string
asked
Jun 3, 2016
in
General
by
Neethu
string
replace
php
0
votes
2
answers
10.1k
views
In PHP using Ternary Operator without the Else statement
asked
Jul 31, 2017
in
General
by
Fahad
php
ternary
if
else
+1
vote
1
answer
1.1k
views
How to modify PHP Source Code
asked
Feb 9, 2017
in
General
by
James
core
modify
php
attack
source
+2
votes
1
answer
679
views
Raspberry with PHP
asked
Feb 9, 2017
in
General
by
Marc Lentin
raspberry
php
+1
vote
1
answer
2.7k
views
Php Soap client add .pem file not working .. SOAP UI process attached for more details
asked
Nov 25, 2016
in
General
by
srinivasulu_yagnam
(
200
points)
php
security
soap
0
votes
2
answers
958
views
PHP Soap client add .pem file
asked
Nov 24, 2016
in
General
by
srinivasulu_yagnam
(
200
points)
php
security
All categories
General
(38)
CMS
(21)
Frameworks
(20)
eCommerce
(58)
IOT - Internet Of Things
(4)
Javascript
(6)
Databases
(1)
Categories
All categories
General
(38)
CMS
(21)
Frameworks
(20)
eCommerce
(58)
IOT - Internet Of Things
(4)
Javascript
(6)
Databases
(1)
Most popular tags
magento
wordpress
php
wp
category
module
product
laravel
kohana
admin
url
cache
jquery
database
configurable
serial1
serial
encrypt
phalcon
truncate
fishpig
js
include
javascript
cms
backend
email
plugin
post
arduino
seo
security
migrate
editor
decrypt
python
iot
map
json
shipping
password
core
log
mage
pear
string
replace
extension
import
php7
error
function
form
order
google
image
youtube
customer
site-links
adblocker
qr-code
barcode
samsung
mac
popup
newsletter
feed
auto-numbering-column
datatable
admin-bar
adminbar
toolbar
mongodb
address16
address64
xbee
301
302
parents
execution-time
calculate
case-sensitive
contains
interface-class
abstract-class
ternary
ajax
cancel
oracle12c
xampp
isset
submit
extract
matrix
uno
mega
coupon
print_r
programatically
member
...