Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2007, 08:25 AM
Registered User
 
Join Date: Jan 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aaaa0441
Default What's the difference between these two methods?

What's the difference between these two methods for adding new item into a array?

1. array_push(aArray,aItem);

2. aArray[]=aItem;

--------------------------
May the force be with you.
 
Old January 17th, 2007, 05:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
see the following example
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>

Ref: http://au3.php.net/array_push

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
 
Old January 18th, 2007, 09:12 AM
Registered User
 
Join Date: Jan 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aaaa0441
Default

Do you mean that the only difference is using array_push(), we can add multiple items into the array in one go?

--------------------------
May the force be with you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Static methods spinjob BOOK: Professional C++ 7 March 12th, 2009 02:16 PM
METHODS magagulad Java GUI 3 May 15th, 2007 12:53 PM
Dispose() methods bpevangelista BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 2 May 12th, 2007 11:15 PM
Treeview Methods goldwinger C# 2005 0 December 29th, 2005 10:00 AM
Please help me with web methods DiegoF .NET Web Services 3 April 10th, 2004 11:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.