faqts : Computers : Programming

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 21 people (81%) answered Yes
Recently 6 of 10 people (60%) answered Yes


how can i use like operator in conditional statements in PHP

Apr 20th, 2003 01:15
Rachit Bagda, Shashank Tripathi, Rama,

Not sure what you mean, but LIKE is usually a part of SQL. Which means 
it is available to you only within databases. To compare strings within 
PHP or other programming languages, you need to use string matching 
functions. E.g., in PHP, conceptually:
If you had this in your SQL -- 
WHERE NAME LIKE '%keyword%'
This can be written in PHP as -- 
if (strpos($NAME, "keyword")) 
    // Found, do what is needed..
Does this help?