Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2008, 10:00 PM
Junior Member
 
Join Date: Apr 2008
Posts: 1
Send a message via MSN to kweek
Default [solved] Zend_Validate_InArray with Zend_Validate::is()

This works, the $array should be in an array
PHP Code:
$value1 'foo';
$value2 'bar';
$array = array('apple''foo''banana');

if (
Zend_Validate::is($value1'InArray', array($array))) {
    echo 
$value1 ' is in array';
}
else {
    echo 
$value1 ' is not in array';
}

if (
Zend_Validate::is($value2'InArray', array($array))) {
    echo 
$value2 ' is in array';
}
else {
    echo 
$value2 ' is not in array';

Thanx for viewing my post

------------------------- original post -------------------------
Hi, I'm trying to use Zend_Validate_InArray with Zend_Validate::is() but I can't get to the right syntax.

From the docs i came to this test but it doesn't work.

PHP Code:
$value1 'foo';
$value2 'bar';
$array = array('apple''foo''banana');

if (
Zend_Validate::is($value1'InArray'$array)) {
    echo 
$value1 ' is in array';
}
else {
    echo 
$value1 ' is not in array';
}

if (
Zend_Validate::is($value2'InArray'$array)) {
    echo 
$value2 ' is in array';
}
else {
    echo 
$value2 ' is not in array';

I get the following error:
Catchable fatal error: Argument 1 passed to Zend_Validate_InArray::__construct() must be an array, string given.

I juggled with the argument order but I didn't get to the right syntax. Does somebody know what I'm doing wrong?

Last edited by kweek : 04-27-2008 at 07:38 PM. Reason: problem solved
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:50 AM.