- substr: documentation ( source)
- var_dump: documentation ( source)
- strip_tags: documentation ( source)
- strrpos: documentation ( source)
<?php
$values = array(
'a < b',
'a< b',
'a <b',
'a <b d> c'
);
foreach ($values as $fieldValue) {
var_dump(strip_tags($fieldValue));
$lastLessThanPos = strrpos($fieldValue, '<');
if (false === $lastLessThanPos) {
continue;
}
$lastGreaterThanPos = strrpos($fieldValue, '>');
$nextChar = substr($fieldValue, $lastLessThanPos + 1, 1);
var_dump($lastGreaterThanPos, $nextChar);
}