[Pmwiki-users] Re: calculating directives

J. Meijer commentgg
Sat Jun 19 21:05:07 CDT 2004


Sure! It was added in blindness while formatting the code for them
plain-text line-breaks.

Thanks :-)
Goodnight.

  ----- Original Message -----
  From: Patrick R. Michaud
  Subject: Re: [Pmwiki-users] Re: calculating directives

  Just a note that the '+' operator is for numeric addition and not
  string concatenation, at least in later versions of PHP.  Thus on
  my system $evalfulist is always ending up as '0'.  You probably
  meant to use '.' instead.

  Nice script, though.

  Pm



THE PM-CORRECTED VERSION:

# inline calculations with var storage: ?formula? ?formula=$var? and ?$var?
$evalfulist='a?sinh?|a?cosh?|a?tanh?|deg2rad|rad2deg|sqrt|pi|log|'.
   'log10|exp|pow|hexdec|dechex|round|rand|';
 $evalfulist="((?:".str_replace('|','\\(|',$evalfulist).'&|>|'.
   '<|\$\\w*|[0-9.eE+-\\/*%|~\\(\\) ])+?)';
 $DoubleBrackets['/?'.$evalfulist.'(=\\$([a-z]*))??/e']=
     "eval(str_replace('\$','\$gfr','\$$3='.
      html_entity_decode('$1')).';return (\'$2\')?\'$1\':\$gfr;')";




More information about the pmwiki-users mailing list