For some reason stripos isn't having the desired affect I thought it should have.
What im trying to do here is if one variables contents partially match another then override that variable.
<?php
$street = 'Lightbowne Road';
$addresline1 = '284 Lightbowne Road ';
$addresline2 = 'Lightbowne Road ';
$addresline3 = '284 Lightbowne Road';
$addresline4 = 'jim ';
$addresline5 = 'Lightbowne Road';
if ( stripos($street, $addresline1) !== false ) {
$addresline1 = 'addresline1 ';
}
if ( stripos($street, $addresline2) !== false ) {
$addresline2 = 'addresline2 ';
}
if ( stripos($street, $addresline3) !== false ) {
$addresline3 = 'addresline3 ';
}
if ( stripos($street, $addresline4) !== false ) {
$addresline4 = 'addresline4 ';
}
if ( stripos($street, $addresline5) !== false ) {
$addresline5 = 'addresline5 ';
}
$addresslines = $addresline1.$addresline2.$addresline3.$addresline4.$addresline5;
$streetcomp = trim($street.' '.$addresslines);
echo '<p><strong>street:</strong> '.$street.'</p>';
echo '<p><strong>addresline1:</strong> '.$addresline1.'</p>';
echo '<p><strong>addresline2:</strong> '.$addresline2.'</p>';
echo '<p><strong>addresline3:</strong> '.$addresline3.'</p>';
echo '<p><strong>addresline4:</strong> '.$addresline4.'</p>';
echo '<p><strong>addresline5:</strong> '.$addresline5.'</p>';
echo '<p><strong>streetcomp:</strong> '.$streetcomp.'</p>';
?>
So for the above code the desired output should be:
street: Lightbowne Road
addresline1: addresline1
addresline2: addresline12
addresline3: addresline3
addresline4: jim
addresline5: addresline5
but it does not it comes out as:
street: Lightbowne Road
addresline1: 284 Lightbowne Road
addresline2: Lightbowne Road
addresline3: 284 Lightbowne Road
addresline4: jim
addresline5: addresline5
So its basically just doing an exact match. Which we don't want.