i am trying to remove last array after i made an explode on this strings: Example 1
Adress1
Adress2
String1 : String2
Example 2
Adress1
Adress2
Adress3
String1 : String2
My idea was first to check if their is a match " : " in string(adrori) then the last array "String1 : String2" should be removed completely. No matther how much array counts would be counted.
Here is my code:
if (preg_match("/ : /", $adrori)) {
$arr2 = explode("\n", $adrori);
$adrori = array_pop($arr2);
$adrori = implode("\n", $adrori);
}
thanks
var_export($adrori);that corresponds to the examples?