<?php
if(isset($undoc)){
$tab_tab_result = array('un','deux','trois','quatre','cinq');
return $tab_tab_result;
}
?>
<?php
//id du calendrier des match en court
$iddoc = $modx->documentIdentifier;
//recuperation des categorie
$tab_cat = $modx->runSnippet('ditto_cal_recup',array('undoc'=>96));
return 'array? '.is_array($tab_cat). ' nbr '. count($tab_cat). ' value: '. $tab_cat;
?>

echo "<pre>"; print_r($returned); echo "</pre>";
I try your code and it’s returning: Array
echo "<pre>";
print_r($returned);
echo "</pre>

array('un','deux','trois','quatre','cinq')

MISLEADING CODE EXAMPLE REMOVED
Snippets must return strings when executed as tags inside of content; this is why it is happening. The only way you could make use of an array as a return value from a snippet is by executing directly via API...
//recuperation des categorie
$tab_cat = $modx->runSnippet('ditto_cal_recup',array('undoc'=>96));
...
foreach($tab_cat as $value)
......
<?php
if(isset($undoc)){
$tab_tab_result = array('un','deux','trois','quatre','cinq');
$modx->setPlaceholder('tab_cat', $tab_tab_result);
}
?><?php
//id du calendrier des match en court
$iddoc = $modx->documentIdentifier;
//recuperation des categorie
$modx->runSnippet('ditto_cal_recup',array('undoc'=>96));
$tab_cat = $modx->getPlaceholder('tab_cat');
...
foreach($tab_cat as $value)
......
?>
Thanks a lot for your explanation
now i understand
One more question, is it possible to write functions into a snippet code?
I wasn’t able to make it work, so i used a snippet instead.
What’s best for repetitive tasks inside snippet code, a function or a snippet call?
Thanks again, and sorry for my English, i try to do my best.
See the site in my sig. for more information on how MODx works.Ok, i’ll read that very soon!
global $modx;