View Full Version : nothing to doo
308holes
August 31st, 2001, 14:30
i have nothing to do so i just want to say
$myvar = "Hello World!";
for ($i=0; $i<10; $i++) {
echo $myvar."\n";
}
lucifer
September 2nd, 2001, 16:20
$myvar = "Hello World!";
for ($i=0; $i<10; $i++) {
echo "$myvar<br>";
} looks nicer :)
308holes
September 4th, 2001, 04:10
thanks
meow
September 4th, 2001, 04:53
:biggrin2:
vedette
September 4th, 2001, 21:11
I don't know anything about php.
Looks confusing.
Bruce
September 4th, 2001, 22:04
Less confusing than perl.
308holes
September 5th, 2001, 02:12
i dont know php i know perl better than php
Dusty
September 5th, 2001, 07:02
i dont know php i know perl better than phpI 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>......"
bigperm
September 5th, 2001, 07:19
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?
Dusty
September 5th, 2001, 14:08
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:
myvar="Hello World!"
For i=1 to 10 step 1
response.write myvar & "\n"
Next
C++
string myvar="Hello World!";
for(i=1; i<10; i++){
cout << myvar << endl;
}
Python
myvar="Hello World!"
for i in range(9):
print myvar,"\n"
JavaScript
var myvar="Hello World!";
for (i=1; i<10; i++){
document.writeln(myvar);
}
QBasic
dim myvar$ as string
myvar$="Hello World!"
for i = 1 to 10
print myvar$
next i
ColdFusion
<cfset myvar="Hello World!">
<cfloop index="i" from="1" to="10">
<cdoutput>
#myvar#
</cfoutput>
</cfloop>
308holes
September 5th, 2001, 14:44
COOl i knew the JavaScript and C/C++ thanks for the others
JAVA
class helloworld
{
public static void main( String[] arguments )
{
System.out.println( "Hello World" );
}
}
roblev
September 5th, 2001, 16:02
PHP rokz! :p
niv
September 5th, 2001, 17:34
ColdFusion/ASP < PHP < Perl
BASIC < ANSI C/C++ < Assembly
Dusty
September 5th, 2001, 20:14
<cdoutput>Oops, that should of course be <cfoutput>.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.