Been trying to tackle this problem I have for a while now and I’m sure it’s simple but I just can’t get it to work.
Basically I have a file containing some string content:
Description: PHP is an HTML-embedded scripting language. PHP attempts to
make it easy for developers to write dynamically generated webpages.
I’d like to use divide the file up based on Name, Version & Description and push each string into a associative array
[name] => ‘php’
[version] => ‘5.1.6’
[description] => ‘PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated webpages.’
I’m currently experimenting with preg_match_all to do this which seems to work but only for values which are no longer and a single line. Any value more than one line like Description gets stripped and only the last line sets stored in the array.
Does anyone out there know if I’m doing this correct or is there a better method.
Thanks for your time