For some time ago i managed to do my first preg_match functions, all was working great until i had to use preg_replace.
I use an compiler on my code, all works but the preg_replace of course.
Code: Select all
class NtMacAddress{
function getMac(){
exec("ipconfig /all", $output);
foreach($output as $line){
if (preg_match("/(.*)Physical Address(.*)/", $line)){
$mac[] = preg_replace("/(.*):/i","lol",$line);
}
}
return $mac;
}
}
echo "MAC: \n\n";
print_r(NtMacAddress::getMac());
Physical Address . . . . . . . . . . . : XX:XX:XX:XX:XX:XX
It should be: ( lol is there only for testing purposes )
lol XX:XX:XX:XX:XX:XX
Any idea?
I know that my expressions or logic is incorrect @ preg_replace("/(.*):/i","lol",$line);