Hi!

>     This may be not so easy to implement - imagine passing $array[*1:4] by
>     reference. 
> 
> 
> This would be the same as doing 
> $array[array_keys($old_array)[1]] = $new_array[0];
> $array[array_keys($old_array)[2]] = $new_array[1];
> $array[array_keys($old_array)[3]] = $new_array[2];
> $array[array_keys($old_array)[4]] = $new_array[3];

I don't think you understood what I am saying. Lvalues in PHP can be
used not only in assignment context, but also in passing-by-ref context,
and in that case I have no idea how you pass $array[*1:4] by reference -
what is actually passed?

> There is the array_splice method that can do the same thing, however
> this to me is less obvious as to what is happening:

I don't see any reason why it would be less obvious, if you bother to
look at man page of array_splice once.

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to