PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
deras
Forum Newbie
Posts: 24 Joined: Sun Nov 02, 2003 10:26 am
Post
by deras » Sat Jan 22, 2005 1:09 am
i am moving a script from perl to php and i the following array does not work in the new php version. what do i need to change to get it to work?
Code: Select all
@x=($m1,$m2,$m3);
$n=1;
foreach $v(@x){
$var="md".$n;
if($v > 90 ){$$var ="||||||||||||||||||||||";}
elsif($v >80 ){$$var ="||||||||||||||||||||";}
elsif($v > 70 ){$$var ="||||||||||||||||||";}
elsif($v > 60 ){$$var ="||||||||||||||||";}
elsif($v > 50 ){$$var ="||||||||||||||";}
elsif($v > 40 ){$$var ="||||||||||||";}
elsif($v > 30 ){$$var ="||||||||||";}
elsif($v > 20 ){$$var ="||||||";}
elsif($v > 10 ){$$var ="||||";}
elsif($v > 0 ){$$var ="||";}
$n++;
}
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Jan 22, 2005 1:16 am
Code: Select all
$x = array($m1, $m2, $m3);
$n = 1;
foreach($x as $v)
{
$var = 'md' . $n;
if($v > 90 ){$$var ="||||||||||||||||||||||";}
elsif($v >80 ){$$var ="||||||||||||||||||||";}
elsif($v > 70 ){$$var ="||||||||||||||||||";}
elsif($v > 60 ){$$var ="||||||||||||||||";}
elsif($v > 50 ){$$var ="||||||||||||||";}
elsif($v > 40 ){$$var ="||||||||||||";}
elsif($v > 30 ){$$var ="||||||||||";}
elsif($v > 20 ){$$var ="||||||";}
elsif($v > 10 ){$$var ="||||";}
elsif($v > 0 ){$$var ="||";}
$n++;
}I think.. it's been a while since I worked in perl..
AGISB
Forum Contributor
Posts: 422 Joined: Fri Jul 09, 2004 1:23 am
Post
by AGISB » Sat Jan 22, 2005 1:48 am
$$var ?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Jan 22, 2005 1:50 am
AGISB
Forum Contributor
Posts: 422 Joined: Fri Jul 09, 2004 1:23 am
Post
by AGISB » Sat Jan 22, 2005 1:52 am
But in Perl that is a Perl Process ID Variable so I guess there is your possible error
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Jan 22, 2005 1:53 am
true.. but he did say he's moving stuff over from perl to php.. so I take the code as half perl, half php.
AGISB
Forum Contributor
Posts: 422 Joined: Fri Jul 09, 2004 1:23 am
Post
by AGISB » Sat Jan 22, 2005 1:55 am
So I guess we need more input of what this code is supposed to do and what is does at the moment
deras
Forum Newbie
Posts: 24 Joined: Sun Nov 02, 2003 10:26 am
Post
by deras » Sat Jan 22, 2005 2:22 am
what i posted was 100% perl code