From:             illicitcriminal at gmail dot com
Operating system: Windows
PHP version:      4.3.10
PHP Bug Type:     Feature/Change Request
Bug description:  Name Variable After Variables

Description:
------------
I think it'd be VERY useful to be able to declare/state variables based on
the value of another variable. I've run into situations where it would save
me a bit of time if this were possible.

In "Reproduce Code", I'll show you a piece that would be useful for an
encryption function that I wrote.

Reproduce code:
---------------
/*
    Giving Letters Numerical Values
*/

$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$length = strlen($alphabet);

for ($cur=0;$cur<$length;$cur++){
    $letter = substr($alphabet, $current, $current+1);
    $numberVal = $current+1;
    /*
        This is where my idea comes in to play.
        To be able to name the variable "a",
        referred to as $a (and b,c,d so on...).
        I've used the syntax ^$var to define the naming
        of the variable dependant on the value of
        $var (another variable)...
    */
    ^$letter = $numberVal;
}

echo $a.'-'.$b.'-'.$c.'-'.$A.'-'.$B.'-'.$C;

Expected result:
----------------
1-2-3-26-27-28

Actual result:
--------------
Probably an "unexpexted '^'" parse error.

-- 
Edit bug report at http://bugs.php.net/?id=33038&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33038&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33038&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33038&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33038&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33038&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33038&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33038&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33038&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33038&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33038&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33038&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33038&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33038&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33038&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33038&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33038&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33038&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33038&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33038&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33038&r=mysqlcfg

Reply via email to