onedumbcoder Posted May 29, 2008 Share Posted May 29, 2008 Hi Guys, Is there a way to find out what the length of a variable is without counting the spaces in php? for example $s = " Hell o There"; And also I am still looking to see if anyone can tell what is wrong with this query i dont know why this query will not work $query = "SELECT * FROM collection WHERE SUBSTRING(word,-4,1) = SUBSTRING('" . $word . "', -4,1) "; SELECT * FROM collection WHERE SUBSTRING(word, -4,1) = SUBSTRING('Hello', -4,1) ORDER BY row Link to comment Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 First question: I'm sure there's a better way than this, but: <?php $s = " Hell o There"; $a = explode(" ", $s); $a = implode("", $a); $a = strlen($a); echo $a; ?> 2nd question: Okay, this is the 3rd time you have asked the same thing. Personally I think the first question was a thinly veiled attempt to pass your question off again. If you cannot follow the rules, action will be taken against you. Thread closed. Link to comment Share on other sites More sharing options...
Recommended Posts