I have comments like that :
!-- comname1 --!
value1
!-- end comname1 --!
!-- comname2 --!
value2
!-- end comname2 --!
Now :
How can me get associative array like this
$var[comname1] = value1;
$var[comname2] = value2;
can any body help me to do that ?
Here's the code...
-js
$string = EOF
!-- comname 1--!
value 1
!-- end comname 1--!
!-- comname 2--!
value 2
!-- end comname 2--!
EOF;
preg_match_all('/!--\s*(.*)\s*--!\s*(.*)\s*!--\s*end\s*\\1\s*--!/i',
$string, $matched);
$array = array();
foreach ( $matched[1] AS $i = $m )
{
$array[$m]
2 matches
Mail list logo