263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 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
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+5 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
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+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
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

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

215 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Sells items exclusively on Envato Market
+1 more
Ziyad says

You live and learn, eh 360

263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by