peer code review wanted
| From: | Erik Price | Date: | Mon, 15 Apr 2002 20:44:42 +0000 |
| Subject: | peer code review wanted | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93082@lists.php.net to get a copy of this message | ||
Hi, I am just not seeing what is wrong with my code.
Can anyone tell me if there is anything wrong with the following function?
function set_material_id($material_id)
{
if (!preg_match('/^\d{1,3}$/', $material_id)) {
return false;
} else {
$this->ff_material_id = $material_id;
}
}
The value being passed to this function is "1" (contained in a POST form field named "ffmaterial0"), yet it is returning false. I have a test in my script that looks like this:
} elseif (!$ff_instance->set_material_id($_POST["ffmaterial{$ff_counter}"])) {
die("set_material_id() method of \$ff_instance failed");
And I am getting the "die()" error message. $ff_counter is 0, the first iteration of a for loop.
Can anyone see a problem with this, or at least confirm that I'm not crazy?
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
pricee@hhbrown.com