[pmwiki-users] define $FmtPV via foreach

noskule noskule at gmx.net
Fri Oct 3 03:48:54 CDT 2008


Dominique Faure schrieb:
> On Thu, Oct 2, 2008 at 21:32, noskule <noskule at gmx.net> wrote:
>   
>> hi list
>> I try to define page variables out of an array:
>>
>> $skinsection_ptv_arr = array(
>> "SectionA" => 1,
>> "SectionB" => 0,
>> ...
>> );
>>
>> foreach ( $skinsection_ptv_arr as $ptvname => $val ) {
>>  $FmtPV['${$ptvname}]' = "'$val'";
>>  }
>>
>> I cant figure out the right syntax for the variable name in $FmtPV,
>> anyone a suggestion
>>
>>     
>
> Perhaps:
>
>   foreach ($skinsection_ptv_arr as $ptvname => $val ) {
>     $FmtPV['$' . $ptvname] = "'$val'";
>   }
>
>   
yep, or     $FmtPV["$$ptvname"] = "'$val'"; did the trick
thanks






More information about the pmwiki-users mailing list