[PHP] Newbie continued..wrong datatype
This is a continue from this morning (thanks so much for the responses).. yielding a data type mismatch: $CheckArr = array(Periodic, Sale, Return); IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) { PRINT BR$approvalcode; PRINT ; PRINT $type; } This line: IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) Causes this error: Warning: Wrong datatype for second argument in call to in_array in /home/www/globalspacesolutions/php3/billingtrx.php on line 47 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie continued..wrong datatype
As far as I'm aware, the first argument to the in_array() function is the needle (what you're searching for) and the second is the array to be searched through (the haystack). So if $type represents what you're searching for, then it would be written as: in_array($type, $CheckArr); If you supply the third argument as TRUE, then the search becomes case sensitive, I believe. HTH! Rw [EMAIL PROTECTED] 07/11/02 02:25PM This is a continue from this morning (thanks so much for the responses).. yielding a data type mismatch: $CheckArr = array(Periodic, Sale, Return); IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) { PRINT BR$approvalcode; PRINT ; PRINT $type; } This line: IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) Causes this error: Warning: Wrong datatype for second argument in call to in_array in /home/www/globalspacesolutions/php3/billingtrx.php on line 47 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie continued..wrong datatype
That did it! Thanks! - Original Message - From: Martin Clifford [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 11, 2002 1:32 PM Subject: Re: [PHP] Newbie continued..wrong datatype As far as I'm aware, the first argument to the in_array() function is the needle (what you're searching for) and the second is the array to be searched through (the haystack). So if $type represents what you're searching for, then it would be written as: in_array($type, $CheckArr); If you supply the third argument as TRUE, then the search becomes case sensitive, I believe. HTH! Rw [EMAIL PROTECTED] 07/11/02 02:25PM This is a continue from this morning (thanks so much for the responses).. yielding a data type mismatch: $CheckArr = array(Periodic, Sale, Return); IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) { PRINT BR$approvalcode; PRINT ; PRINT $type; } This line: IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) Causes this error: Warning: Wrong datatype for second argument in call to in_array in /home/www/globalspacesolutions/php3/billingtrx.php on line 47 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie continued..wrong datatype
The manual says the second parameter needs to be an array. I assume it is not, but you have not shown us how $type is assigned so we cannot tell. HTH Chris Rw wrote: This is a continue from this morning (thanks so much for the responses).. yielding a data type mismatch: $CheckArr = array(Periodic, Sale, Return); IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) { PRINT BR$approvalcode; PRINT ; PRINT $type; } This line: IF (SUBSTR($approvalcode,0,1) == Y in_array($CheckArr, $type)) Causes this error: Warning: Wrong datatype for second argument in call to in_array in /home/www/globalspacesolutions/php3/billingtrx.php on line 47 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php