Hi,

Can someone tell me if it's possible to create variable names from
varaible names? I could work around this problem using some if/else
statements, but I'm interested to see if there's another solution.

I have 20 associative arrays all named compA, compB, compF, etc. The
user supplies a string e.g. "YB"...

// one of the 20 arrays
 $compY = array ( // Y   Tyr   Tyrosine
 "H" => 9
,"X" => 2
,"C" => 9
,"N" => 1
,"O" => 2
,"S" => 0
);

 $sequence = "YB";
 $sequence = strtoupper ($sequence);
 for ($i = strlen($sequence)-1; $i >= 0; $i--)
 {
     // create a temp variable called comp + $i
     // e.g. on first iteration access the array, $compB
     // and on the second, access $compY
 }

Thanks very much in advance.

- Best regards,
Lee Reilly


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to