Reply to Re: unexpected $ (about 70 lines)

Your name:

Reply:


Posted by Rik on 05/06/06 16:34

RenTechie wrote:
> I get this error:
> Parse error: parse error, unexpected $ in [file] on line 63
> Where [file] is the path and filename for a file containing:
> <snip code>

Check your nesting, opening and closing {}, I don't think they're right.
Maybe it's disappeared in posting, but you function powercentres() doesn't
seems to close here.

Also, think about switch statements instead of elseif's.

Further
if($roll-1<=13){
$pcs[1]['type']='conventional';
if(rand(1,20)==1){ // do you have a particular use for a new rand()?
// you don't do anything here
}elseif($roll-1<=18){
$pcs[1]['type']='nonstandard';
}else{
$pcs[1]['type']='magical';
}
};

Reads as: $pcs[1]['type'] is 'conventional' is $roll < 14, if $roll is > 14
AND a new rand(1,20)==1, $pcs[1]['type'] doesn't get set at all!

Also: all the code in your powercentres() function doesn't get executed, as
the first thing you do is returning a statical array.

Proper tools for coding (syntax highlighting) and indenting code could have
told you a lot.

It's not pretty, no it sure ain't.
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация