Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 07-28-2014, 01:50 AM
kontrol's Avatar
kontrol kontrol is offline
Contributing Member
 
Join Date: 02-10-10
Posts: 225
iTrader: 0 / 0%
php array problem

i want to display the content of an array starting from a specific key and ending at a specific key. i don't want to list them manually, how do I please?
 

Advertisement

Advertisement

  #2  
Old 07-28-2014, 03:08 AM
kontrol's Avatar
kontrol kontrol is offline
Contributing Member
 
Join Date: 02-10-10
Posts: 225
iTrader: 0 / 0%
no reply yet, well aray_slice is the solution. thank you
 
  #3  
Old 07-28-2014, 05:35 AM
ScriptMan's Avatar
ScriptMan ScriptMan is online now
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,016
iTrader: 4 / 100%
Why don't you illustrate how that works with an example.
 
  #4  
Old 07-28-2014, 10:25 AM
kontrol's Avatar
kontrol kontrol is offline
Contributing Member
 
Join Date: 02-10-10
Posts: 225
iTrader: 0 / 0%
PHP Code:
if($start == 0){
      
$trim array_slice($arr$start$slice);
      while (list(
$key$value) = each($trim)) {
         echo 
$value;
      }
      
$next_start $start+20;
   }else{
      
$trim array_slice($arr$start$slice);
      while (list(
$key$value) = each($trim)) {
         echo 
$value;
      }
      
$next_start $start+20;
   } 
 
  #5  
Old 07-30-2014, 03:20 AM
george.markou13's Avatar
george.markou13 george.markou13 is offline
Contributing Member
 
Join Date: 10-30-13
Location: athens
Posts: 106
iTrader: 0 / 0%
more simply :

lets say you have this array:

$arr=array(0,10,20,30,40,50,60,70,80,90);

$start=2;
$end=3;


for ($i=$start;$i<=$end;$i++){
echo $arr[$i]."<br />";
}
 
  #6  
Old 08-07-2014, 01:15 AM
freelance-developer's Avatar
freelance-developer freelance-developer is offline
Contributing Member
 
Join Date: 03-28-14
Posts: 105
iTrader: 0 / 0%
Quote:
Originally Posted by george.markou13 View Post
more simply :

lets say you have this array:

$arr=array(0,10,20,30,40,50,60,70,80,90);

$start=2;
$end=3;


for ($i=$start;$i<=$end;$i++){
echo $arr[$i]."<br />";
}


Thanks. This is a good help!
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sort array problem Vincentas Coding Forum 1 02-05-2013 05:42 AM
jQuery ajax, json, PHP array problem NayDreams Coding Forum 3 05-28-2011 11:08 PM
Problem with function in array (PHP) virtualmisc Coding Forum 1 03-29-2010 09:42 AM
For fun: Delete an array from array kos Coding Forum 3 05-30-2009 10:33 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 03:54 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC