Web Hosting Talk







View Full Version : Increasing a variable


Kemik
07-27-2007, 08:56 AM
Hello,

I have a list of arrays stored in variables ($s1, $s2, $s3...) and want to compare the variables.

E.g.

<?php

$g2 = $s1

if ($s1['b'] = $s2['t']) {

echo '$s1 matches $g2';
// Here I want to increase $g2 by one. E.g. $g2 = $s2

} else {

// Again, I want to increase $g2 = $s2

}
?>


Does anyone know how I would increase the variable number? $g2 = $g2 + 1 won't work as that would only increase the value in the variable, not the variable name.

e-zone
07-29-2007, 09:45 AM
Im shure you will get some help if you post this in the programming forum, some nice people there can help you.