[RESOLU] ARRAY

Petit nouveau ! | 8 Messages

06 nov. 2015, 15:31

Bonjour,

Travaillant sous Wordpress, j'aurais besoin de traduire ce genre de code de retour :

Code : Tout sélectionner

Array ( [0] => Array ( [title] => tt1 [layout] => d [limit] => [one_column] => 1 [top_layout] => 0 [top_limit] => 1 [cat] => Array ( [0] => 12 ) [tag] => [time] => 0 [order] => rand [manual] => [action] => slider [pagination] => infinite-scroll [action_link_text] => View all [action_link_url] => http:// [autoplay] => [type] => posts ) [1] => Array ( [title] =>tt2 [layout] => d [limit] => [one_column] => 1 [top_layout] => 0 [top_limit] => 2 [cat] => Array ( [0] => 11 ) [tag] => [time] => 0 [order] => date [manual] => [action] => slider [pagination] => numeric [action_link_text] => View all [action_link_url] => http:// [autoplay] => [type] => posts ) [2] => Array ( [title] => tt2 [layout] => d [limit] => [one_column] => 1 [top_layout] => 0 [top_limit] => 2 [cat] => Array ( [0] => 13 ) [tag] => [time] => 0 [order] => rand [manual] => [action] => slider [pagination] => infinite-scroll [action_link_text] => View all [action_link_url] => http:// [autoplay] => [type] => posts ) [3] => Array ( [title] => tt2 [layout] => d [limit] => [one_column] => 1 [top_layout] => 0 [top_limit] => 2 [cat] => Array ( [0] => 128 ) [tag] => [time] => 0 [order] => date [manual] => [action] => slider [pagination] => load-more [action_link_text] => View all [action_link_url] => http:// [autoplay] => [type] => posts ) )

dans une déclaration de tableau PHP, dans ce style :

Code : Tout sélectionner

$fruits = array ( "fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"), "numbers" => array(1, 2, 3, 4, 5, 6), "holes" => array("first", 5 => "second", "third") )
;

Pourriez-vous m'aider car je ne comprends pas l'arborescence du ARRAY qui m'est retourné
merci d'avance.

Mammouth du PHP | 2703 Messages

06 nov. 2015, 16:42

voir si l'affichage dans le code source de la page plutôt que directement dans le navigateur, n'a pas un formatage qui rend le tout bien plus compréhensible.

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 9783 Messages

06 nov. 2015, 18:09

Indenté proprement, ça donne juste un tableau classique qui contient lui même des tableaux :
Array ( 
	[0] => Array (
		[title] => tt1 
		[layout] => d 
		[limit] => 
		[one_column] => 1 
		[top_layout] => 0 
		[top_limit] => 1 
		[cat] => Array ( 
			[0] => 12
		) 
		[tag] => 
		[time] => 0 
		[order] => rand 
		[manual] => 
		[action] => slider 
		[pagination] => infinite-scroll 
		[action_link_text] => View all 
		[action_link_url] => http:// 
		[autoplay] => 
		[type] => posts
	) 
	[1] => Array ( 
		[title] =>tt2 
		[layout] => d 
		[limit] => 
		[one_column] => 1 
		[top_layout] => 0 
		[top_limit] => 2 
		[cat] => Array ( 
			[0] => 11
		) 
		[tag] => 
		[time] => 0 
		[order] => date 
		[manual] => 
		[action] => slider 
		[pagination] => numeric 
		[action_link_text] => View all 
		[action_link_url] => http:// 
		[autoplay] => 
		[type] => posts
	) 
	[2] => Array ( 
		[title] => tt2 
		[layout] => d 
		[limit] => 
		[one_column] => 1 
		[top_layout] => 0 
		[top_limit] => 2 
		[cat] => Array ( 
			[0] => 13
		) 
		[tag] => 
		[time] => 0 
		[order] => rand 
		[manual] => 
		[action] => slider 
		[pagination] => infinite-scroll 
		[action_link_text] => View all 
		[action_link_url] => http:// 
		[autoplay] => 
		[type] => posts
	) 
	[3] => Array ( 
		[title] => tt2 
		[layout] => d 
		[limit] => 
		[one_column] => 1 
		[top_layout] => 0 
		[top_limit] => 2 
		[cat] => Array ( 
			[0] => 128
		) 
		[tag] => 
		[time] => 0 
		[order] => date 
		[manual] => 
		[action] => slider 
		[pagination] => load-more 
		[action_link_text] => View all 
		[action_link_url] => http:// 
		[autoplay] => 
		[type] => posts
	)
)
Quand tout le reste a échoué, lisez le mode d'emploi...

Petit nouveau ! | 8 Messages

06 nov. 2015, 18:25

génial , merci !!