[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: SV: SV: [PROGRAMMERING] Rekursion i php



On Sun, 21 Dec 2003, Jan Andersen wrote:

> bestemt id eller far. Ex hvor far=5 && id=8.
> 
> Hvordan gør jeg så dette?
> 	$array[5][8]['titel']='Ny titel';

Det ser rigtigt ud. Prøv
  echo $array[5][8]['titel'];
og se om du får det rigtige før du retter.

Debug med:
	echo "<pre>";
	var_dump($array);
eller der er vist også noget der hedder printk() eller så.

> Jeg er i stand til at finde den med en løkke
> 	foreach ($array[5] as $punkt){
> 	        if($punkt['id']==8) print $punkt['titel'];
> 	}
> Men sætter jeg $punkt['titel']='Hej'; retter den ikke $array men kun den
> midlertidige værdi...

$punkt er ikke et object, men en kopi.
Prøv denne:
	$n=0;
 	foreach ($array[5] as $punkt){
 	        if($punkt['id']==8) print "$n: ".$punkt['titel'];
		$n++;
 	}
	echo "Der er ".$n." punkter under \$array[5]";

Du kan så rette med
	$array[5][$x]['title']
hvis du har sat $x til noget validt.

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
I spent probably 20 or 30 hours drawing the penguin stuff, and
I've spent four or five years writing code, and I'm still
known for the penguin a lot more than I am for any of the code.
			-- Larry Ewing, creator of Tux


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *