<?php $str = 'export NTPSERVER_1 NTPSERVER_2 NTPSERVER_3 PSLOGHOST LOGHOST RSSHHOST RHPORT NTPSERVER_1=8.8.8.8 NTPSERVER_2= NTPSERVER_3= LOGHOST="8.8.8.8" PSLOGHOST="" RSSHHOST="8.8.8.8" RHPORT=88888'; Preg_match_all("/(\w+)\=(.*)/", $str, $matches); Foreach($matches[1] as $key => $val){ $res[$val] = str_replace('"','',$matches[2][$key]); } Var_dump($res);
You have javascript disabled. You will not be able to edit any code.