[pmwiki-users] define $FmtPV via foreach

Dominique Faure dominique.faure at gmail.com
Fri Oct 3 00:04:56 CDT 2008


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'";
  }

-- 
Dominique



More information about the pmwiki-users mailing list