Jump to content


Photo

arrays


  • Please log in to reply
2 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 April 2006 - 08:00 PM

I need to figure out the best way to master doing arrays, should I get use to the first way or the second way

<?php
$myarray = array("west", "david", "mike", "jim", "bob", "dave", "walton", "korn", "siesmic");
?>
or
the longer way
with writing out each one below it.
Which way is better while I am learning.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 20 April 2006 - 08:11 PM

What you want to use?

The two ways have the same efect, but the first, is so clean and "fast".. so I use it.. the second way.. i use to random data, db reading, errors, ...

# first
$var = array ( $a , $b , '1' , '2' );
# second, mode one
$var[] = $a;
$var[] = $b;
$var[] = '1';
$var[] = '2';
# second, mode two
while ( !feof ($file) )
{
    $var[] = fget ($file);
}
You may chose by your needed.. ;)

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 April 2006 - 08:12 PM

thanks

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users