263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

Lol, this one error just eludes me. Thanks in advance for the help.

Here’s my code:
/*Converts a string to be exported to PHP.*/
var php_insert:Function=function(input:String) {
var output:String = input;
var output = str_replace (output, '&', '/and/');
var output = str_replace (output, '?', '/que/');
var output = str_replace (output, '#', '/num/');
var output = str_replace (output, ':', '/colo/');
var output = str_replace (output, '%', '/perc/');
var output = str_replace (output, '/n/r', '/br/');
var output = str_replace (output, '/r/n', '/br/');
var output = str_replace (output, '/n', '/br/');
var output = str_replace (output, '/r', '/br/');
return (output);
};

/*Converts a string to be imported from PHP.*/
var php_extract:Function=function(input:String) {
var output:String = input;
var output = str_replace (output, '/and/', '&');
var output = str_replace (output, '/que/', '?');
var output = str_replace (output, '/num/', '#');
var output = str_replace (output, '/colo/', ':');
var output = str_replace (output, '/perc/', '%');
return (output);
};
And here’s my error(s):
Warning: 3596: Duplicate variable definition.

Which is called for every line with ‘var output’ in it.

3072 posts
  • Affiliate Level 3
  • Author Level 6
  • Collector Level 2
  • Weekly Top Seller
+7 more
wickedpixel
says

leave only one “var” declaration for the “output” variable; only the line “var output:String = input;” must have “var” in front

2309 posts
  • 7 Years of Membership
  • Affiliate Level 2
  • Author Level 2
  • Beta Tester
+5 more
theflyingtinman
says

You’re joking right?

I can see at least 16 separate definition of the var “output”

...you have to remove the “var” keyword from all but the first .. not just the variable type declaration. :p

263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

Oh, I am new and thought that all variables had to have ‘var’ in front, me es stupido.

215 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 3
  • Exclusive Author
+1 more
Ziyad
says

You live and learn, eh 360

263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

I live and learn alot I guess. About 90% of my posts are questions. =)

by
by
by
by
by
by