22, November 2008

An array question - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: An array question
« previous next »
Pages: [1] Print

Author Topic: An array question  (Read 506 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« on: Apr 12, 2006, 05:50:58 PM »

I have an array with say 40 numbers in it and I want to extract the numbers in position 11 to 20 (the second set of ten), what is the best/fastest way of doing this? Shout if you need any more details...

thanks, wineo


Last blog : Site of the Month - August 2007
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #1 on: Apr 12, 2006, 06:01:28 PM »

I think that I will probably just stick with:

Code:
for i =10; i < count(array); i++

seeing as I am only using php4

but is you know a faster way, let me know!


Last blog : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8250
42487 credits
Members referred : 3



« Reply #2 on: Apr 12, 2006, 10:50:11 PM »

Of course there is a faster way (there is allways one, isn't it?) Smiley

By using array_splice Visit through proxy

check this small example :

Code:
<?php
 
echo '<pre>';
 
$a = array(1,2,3,4,5,6,7,8,9,10);
 
var_dumparray_splice$a4, -) );
?>


Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=2244
Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: An array question
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 10:36:47 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.741
Total Topics: 7.651
Total Members: 4.398
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: egseopro

40 Guests, 4 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.