On Mon, Jan 24, 2005 at 03:54:45PM -0500, [EMAIL PROTECTED] wrote:
> This construct:
> 
>       list($v1, $v2, $v3) = explode($sep, $string, 3);
> 
> will generate NOTICE level errors if there are not enough parts of the 
> string to fill all the variables in the list.  What I really want is 
> for list() to set the variables that have a corresponding array 
> element, and then either don't change the others, or set them to NULL --
> I could live with either approach.
> 
> Anyone see a way to get rid of these errors short of this approach:
> 
>       $parts = explode($sep, $string, 3);
>       switch(count($parts)) {
>               case 3:
>                       $v3 = $parts[2];
>               case 2:
>                       $v2 = $parts[1];
>               case 1:
>                       $v1 = $parts[0];
>       }
> 
> I did try @list(... and it made no difference.

I just tried it with php 4.3.8 and it did not throw a NOTICE with @list.
I suppose you could try @explode as well as @list.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to