This is my code
<div style="display:inline-block; ">
<?php $a = strtolower($criteria); if (strpos($a, 'fits models from: 11/2000') !== false) {
echo 'Fits models from 2000,'; } ?> </div>
I have a problem with the white space.
It finds the string if I use only 'fits models from' or if I use '11/2000', but not the two combined. I need them combined or else it's usless.
EDIT:
I can't do something like this:
<?php $a = strtolower($criteria);
if (strpos($a, 'fits models from') !== false)
if (strpos($a, '11/2000') !== false) {
echo 'Fits models from 2000,'; } ?> </div>
because I want to use it to seperate key factors from a text, which is the car model, from the rest and output that information.
If $criteria says 'fits model from 11/2000, but only fits model until 06/2002' then it will output 'fits model from 2000', 'fits model until 2000', 'fits model from 2002', 'fits model until 2002'.
To identity an unknown character:
- find the string encoding (probably UTF-8 in your case)
- extract a short substring with the character
- split it into bytes and display them in hexadecimal
- looking at the encoding table, find what character it is with the byte(s) used to encode it
example with the string: "a:\xe2\x80\x85b"
that looks like a: b
but with a smaller space.
$str = "a:\xe2\x80\x85b"; // I wrote \xe2\x80\x85 only to set $str and to show a working code,
// but here I don't know what are the values of these bytes
preg_match('~:(.*?)b~us', $str, $m); // shortest substring between : and b
echo implode(' ', array_map(function ($b) { return dechex(ord($b)); }, str_split($m[1])));
// e2 80 85
I obtain the 3 bytes e2
80
85
, then I search if it represents one or several characters in the unicode table and I find: U+2005 e2 80 85 FOUR-PER-EM SPACE
Conclusion: the unknown character is a FOUR-PER-EM SPACE
(unicode point: U+2005) and needs the 3 bytes e2 80 85
to be encoded in UTF-8. So I can write it "\xe2\x80\x85"
in a double quoted string.