• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

nothing to doo

308holes

New Member
i have nothing to do so i just want to say
PHP:
$myvar = "Hello World!";
for ($i=0; $i<10; $i++) {
echo $myvar."\n";
}
 
i dont know php i know perl better than php
I do know both and I don't find one to be any harder or easier than the other. They're both more or less the same (PHP was based almost exclusively on Perl, you know).
Less confusing than perl.
How is it less confusing than Perl? People are always making blanket statements about PHP ("it's less confusing", "it's less complicated", "it's easier to learn", "it's faster to write", etc...) without ever backing them up with any reasons. Here's the same script in Perl:

$myvar="Hello World!";
for ($i=0;$i<10;$i++) {
print $myvar."\n";
}

Apart from substituting "print" for "echo", it's the same exact thing. In fact, you can use "print" in PHP. If you did, then the two scripts are identical! How is the Perl version more confusing than the PHP?
echo "$myvar<br>";
You can't just change \n to <br>, suppose we're not running this from the web? You'd get some messy output, "Hello World!<br>Hello World!<br>Hello World!<br>Hello World!<br>......"
 
Last edited:
THANK YOU DUSTY!

I have always wondered why people say that stuff about php/perl... when it look very similar to me.

So what does this look like in ASP?, C/C++?, Python?, Javascript?, Qbasic? Can it be done in coldfusion?
 
I have always wondered why people say that stuff about php/perl... when it look very similar to me.
My theory is that PHP is the new "in-language" and people just feel compelled to praise it.
So what does this look like in ASP?, C/C++?, Python?, Javascript?, Qbasic? Can it be done in coldfusion?
I don't know all these languages, so some of these are just educated guesses:

ASP:
Code:
myvar="Hello World!"
For i=1 to 10 step 1
response.write myvar & "\n"
Next

C++
Code:
string myvar="Hello World!";
for(i=1; i<10; i++){
cout << myvar << endl;
}

Python
Code:
myvar="Hello World!"
for i in range(9):
     print myvar,"\n"

JavaScript
Code:
var myvar="Hello World!";
for (i=1; i<10; i++){
document.writeln(myvar);
}

QBasic
Code:
dim myvar$ as string
myvar$="Hello World!"
for i = 1 to 10
print myvar$
next i

ColdFusion
Code:
<cfset myvar="Hello World!">
<cfloop index="i" from="1" to="10">
<cdoutput>
#myvar#
</cfoutput>
</cfloop>
 
COOl i knew the JavaScript and C/C++ thanks for the others

JAVA
Code:
class helloworld
{
        public static void main( String[] arguments )
        {
                System.out.println( "Hello World" );
                }
}
 
Last edited:
Back
Top