Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Coding Question


Guest

Recommended Posts

Does anyone now how to code this in PHP ---------->

Remove the last character of a string, IF the last letter of the string is a "S" ????

 

People search my site in the keywrods for dogs and the descriptions in my item file read dog, so the search results come up with nothing.

 

:?

Link to comment
Share on other sites

Does anyone now how to code this in PHP ---------->

Remove the last character of a string, IF the last letter of the string is a "S" ????

 

People search my site in the keywrods for dogs and the descriptions in my item file read dog, so the search results come up with nothing.

 

:?

 

What happens if they search for an item such as "Glass"?

 

Wouldn't a strpos be a better way?

 

$where = strpos($description, $search_term);

if (!is_integer($where)) {

   // we didn't find it...

}

(Code hacked for readibility from the MAN pages.

 

Aodhan

Link to comment
Share on other sites

There is an array function available in PHP that allows you to delete the last character. Don't exactly remember what it is though. I will think of it and post it here tomorrow.

 

-Chris

Chris Sullivan

Link to comment
Share on other sites

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...