[pmwiki-users] ZAP math command...
editor at fast.st
Fri Mar 9 12:16:35 CST 2007
Just came up with a simple plan for a fairly powerful math function.
Can someone help me setup an expression that will test whether or not
$value consists of any characters beside numbers . + - * / (others
will be added if you want more capabilities--via an sdv definition)
Here's what I have but it fails the simple test of 1+2
if ( ! ereg("/0-9\\.\\+\\-\\*\\//", $value)) $m .= "Invalid numeric input. ";
also if (!ereg("/^[0-9|\\.|\\+|\\-|\\*| |\\/]+$/", $value)) $m .=
"Invalid numeric input. ";
Not sure what I'm doing wrong... Just want it air tight since I'll be
using eval for this...
More information about the pmwiki-users