Overwrite Content in PHP fwrite()

Posted by Shahmir Javaid on Stack Overflow See other posts from Stack Overflow or by Shahmir Javaid
Published on 2010-05-14T15:52:01Z Indexed on 2010/05/14 15:54 UTC
Read the original article Hit count: 276

Filed under:
|

Is there any way you can overwrite a line in PHP. let me be a little more clearer using examples.

My array

array{
    [DEVICE] => eth0,
    [IPADDR] => 192.168.0.2,
    [NETMASK] => 255.255.255.0,
    [NETWORK] => 192.168.0.0,
    [BROADCAST] => 255.255.255.255,
    [GATEWAY] => 192.168.0.1,
    [ONBOOT] => no
}

File im overwriting

DEVICE=eth0
IPADDR=192.168.200.2
NETMASK=255.255.255.0
NETWORK=192.168.200.0
BROADCAST=255.255.255.255
GATEWAY=192.168.200.1
ONBOOT=no
DNS1=195.100.10.1

Result of the File that is rewritten

DEVICE=eth0
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=255.255.255.255
GATEWAY=192.168.0.1
ONBOOT=no
DNS1=195.100.10.1

Note that DNS1=195.100.10.1 Stays in the file becuase it dosent have a key with the value of DNS in our array.

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about fileio