I came up with this:
Code: Select all
$file = file("/etc/sysconfig/network/ifcfg-$if");
//Clean whitespace from array ellements
for($i = 0; $i <= 8; $i++)
{
trim($fileї$i]);
}
echo var_dump($file);But the whitespace remains. Here is the output of var_dump():
Are there any obvious mistakes?array(9) {
[0]=>
string(19) "BOOTPROTO='static'
"
[1]=>
string(26) "BROADCAST='192.168.1.255'
"
[2]=>
string(23) "IPADDR='192.168.1.153'
"
[3]=>
string(7) "MTU=''
"
[4]=>
string(24) "NETMASK='255.255.255.0'
"
[5]=>
string(22) "NETWORK='192.168.1.0'
"
[6]=>
string(17) "REMOTE_IPADDR=''
"
[7]=>
string(19) "STARTMODE='onboot'
"
[8]=>
string(26) "UNIQUE='QXTf.TgVqGjtNpC0'
"
}
THanks