- strpos: documentation ( source)
- explode: documentation ( source)
- trim: documentation ( source)
<?php
$row = array();
$row['title'] = 'Mr Smith';
$row['surname'] = 'Smith';
if ( isset($row['title']) && isset($row['surname']) ) {
if ( '' !== trim($row['title']) && '' !== trim($row['surname']) ) {
$titleParts = explode(' ',$row['title']);
if ( count($titleParts) > 1 ) {
if ( -1 !== strpos($row['title'],$row['surname']) ) {
echo 'yay';
}
}
}
}