<HELP!>EVAL()</HELP!>

[email protected] ("Shaowarrior") Mon, 19 Aug 2002 18:25:22 -0400
Newsgroups php.lang
Organization Kensoft
Message-ID <[email protected]>
Hi, right now i'm trying to shorten my script and i'm tryin to make this
switch loop :

    // Copie le nom du fichier dans un tableau

      switch ($ext)
      {
        case 'jpg':
             $imgjpg[$c_jpg] = $repertoire.basename($nomFichier);
             $c_jpg++;
             break;
        case 'gif':
             $imggif[$c_gif] = $repertoire.basename($nomFichier);
             $c_gif++;
             break;
        default:
             echo '    Le fichier '.$nomFichier.' n\'est pas une image
reconnue.<br>';
             break;
      }

looks like an only one eval() line of code (separated for your convenience):

    eval('$img'."\$ext".'[$c_'."\$ext".'] =
$repertoire.basename($nomFichier);
           $c_'."\$ext".'++;
           return();');

Well, this don't work! (Guess why i'm here!) PHP debugger says :

    PARSE ERROR: parse error, unexcepted T_VARIABLE in c:\[...](20):
eval()'d code on line 1

This is it!

If someone can help me I will appreciate it.
Merci beaucoup!

Shaowarrior
[email protected]