I made the following function in php that receives a string, and returns a new string containing only the numbers of the received string.
I just can not concatenate each number to this new string. I've tried the following:
function extraiSoNumsDeString($string){
//Definindo uma String
$result="";
for($i=0; $i<strlen($string); $i++){
$j = substr($string, $i,1);
if ($j>="0" and $j<="9") $result=.$j;
}
//Retorna uma string contendo apenas o número da conta.
return $result;
}
But the interpreter has a syntax error on this line:
if ($j>="0" and $j<="9") $result=.$j;
saying that I can not use this point to concatenate $ j to $ result.
Does anyone know how I could do this concatenation? I need to return a single string in this function ...