> Hey php-general,
>
> maybe somebody can explain me what happens in this line? because how
> mutch i read it..thought i don't get it :)
>
> list ($date, $laik) = split (' ', $row['time'], 2);
Well, it is rather inefficient code. Applying a regex just to break a
string up on a single character is a waste. You should be using explode()
instead of split() here.
As for what it does, if you read php.net/list and php.net/split it should
be pretty obvious.
php.net/split says:
Returns an array of strings, each of which is a substring of string
formed by splitting it on boundaries formed by the regular expression
pattern. If limit is set, the returned array will contain a maximum of
limit elements with the last element containing the whole rest of
string.
So, in your example it will return a 2 element array. Everything before
the first space of the string $row['time'] goes in the first element, and
everything after the first space into the second element.
php.net/list says:
list() is used to assign a list of variables in one operation.
In your case that means that the first element in the array returned from
the split() call ends up in $date and the second element ends up in $laik.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php