[PHP] Splice problem

2003-09-18 Thread Stevie D Peele
My problem is that I am splicing an array and then echoing the array
[code]
?php 
$input = array(red, green, blue, yellow); 
array_splice($input, 2); 

echo $input;
?
[/code]

and all that is echoed is Array. I want red green to be echoed.

Thanks


The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

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



RE: [PHP] Splice problem

2003-09-18 Thread Jay Blanchard
[snip]
My problem is that I am splicing an array and then echoing the array
[code]
?php 
$input = array(red, green, blue, yellow); 
array_splice($input, 2); 

echo $input;
?
[/snip]

Shoulda kept readin', $input is now an array with red and green in it.
http://www.php.net/array_splice

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



Re: [PHP] Splice problem

2003-09-18 Thread CPT John W. Holmes
From: Stevie D Peele [EMAIL PROTECTED]


 My problem is that I am splicing an array and then echoing the array
 [code]
 ?php
 $input = array(red, green, blue, yellow);
 array_splice($input, 2);

 echo $input;
 ?
 [/code]

 and all that is echoed is Array. I want red green to be echoed.

That's because $input IS an array.

Try just displaying $input[0] and $input[1] for red and green.

You also need to assign the result of array_splice() to something...

$new_array = array_splice($input,2);

Maybe you should explain exactly what you're trying to accomplish with all
of this. There may be a better method.

---John Holmes...

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