Search for [ ] and replace everything between it
问题 I have a template file that uses the structure [FIRSTNAME] [LASTNAME] etc etc.... and I will be doing a search and replace on it. One thing that I would like to do is that when the template get's sent back, IF I haven't stipulated, [FIRSTNAME].... it still shows in the template... I would like to make it NULL IF I haven't stipulated any data to that variable. in my code i'm using the FILE_GET_CONTENTS $q = file_get_contents($filename); foreach ($this->dataArray as $key => $value) { $q = str