I have the following code:
<?php
    $atributos = array("id","attr1","attr2","attr4");
    function dinamico()
    {
       $stringData = implode(",",$atributos);
       echo $stringData;
    } 
?>
and it give this:
Warning: implode(): Invalid arguments passed
if I declare this array inside function, It works but not out of it.
Note: I need to declare it outside because I use this array too times.
 
     
    