This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-11 12:33:25

Espevoir
Scratcher
Registered: 2011-05-22
Posts: 16

Can somebody (or somebodies) Explain Php?

I want to learn but don't get it at all. I know Css, Html and some Javascript. Oh and scratch of course  wink
Thanks  smile

Offline

 

#2 2011-11-11 12:36:29

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

I'll answer your question on the web-languages: Help and Helper thread since that's where I'm trying to get all web-oriented programming languages to be discussed!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-11-11 12:46:57

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

PHP I think stands for protocall-hypertext-processor or soemthing. You start a php script with tag <?php and end it with ?>

An echo basic prints text:

Code:

<?php echo("Hello"); ?>

or

Code:

<?php echo "Hello"; ?>

You always end a line of code in PHP with a ;
Lets make PHP echo a variable:

Code:

<?php
$variable = "hello";
echo "$variable world!";
?>

This should echo hello world!

Understand? If so, you just learned the basics of php!  smile

Last edited by WindowsExplorer (2011-11-11 12:48:00)


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#4 2011-11-11 12:49:58

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

WindowsExplorer wrote:

PHP I think stands for protocall-hypertext-processor or soemthing. You start a php script with tag <?php and end it with ?>

An echo basic prints text:

Code:

<?php echo("Hello"); ?>

or

Code:

<?php echo "Hello"; ?>

You always end a line of code in PHP with a ;
Lets make PHP echo a variable:

Code:

<?php
$variable = "hello";
echo "$variable world!";
?>

This should echo hello world!

Understand? If so, you just learned the basics of php!  smile

This will echo "$variable world", WindowsExplorer, since you put the variable in speech marks! you should do:

Code:

echo $variable . " world!";

__________________________________________________________-

My answer to your question: http://scratch.mit.edu/forums/viewtopic … 29#p993629


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2011-11-11 12:55:41

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

sparks wrote:

WindowsExplorer wrote:

PHP I think stands for protocall-hypertext-processor or soemthing. You start a php script with tag <?php and end it with ?>

An echo basic prints text:

Code:

<?php echo("Hello"); ?>

or

Code:

<?php echo "Hello"; ?>

You always end a line of code in PHP with a ;
Lets make PHP echo a variable:

Code:

<?php
$variable = "hello";
echo "$variable world!";
?>

This should echo hello world!

Understand? If so, you just learned the basics of php!  smile

This will echo "$variable world"

nope! It will only echo $bariable word if I did single quotes. Double quotes can handle variables - I do it all the time and it works!


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#6 2011-11-11 13:00:14

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

That's very interesting... I think I need to look into the difference between single and double quotes again. I'm pretty sure it's correct practice to keep variables outside strings and concate them though...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2011-11-11 13:00:39

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

I'm sorry to say this sparks, but [removed by moderator] WE is right!
Double quotes can handle variables (and functions too I think) inside the quotes themselves, whereas single quotes don't and are also therefore faster.

So there are two ways to do this:
"$variable world"
or
$variable . ' world'

ninja'd  hmm
Yes, sparks, it is good practice because in other languages none of this is possible. However, we might as well take advantage of the PHP since it supports it! I myself concatenate strings because that's how I'm used to doing it in VB or C++.

Last edited by Paddle2See (2011-11-11 17:24:08)

Offline

 

#8 2011-11-11 13:23:10

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

Php stands for PHP: Hypertext Preprossesor


http://i.imgur.com/1QqnHxQ.png

Offline

 

#9 2011-11-11 13:29:08

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Can somebody (or somebodies) Explain Php?

TRocket wrote:

Php stands for PHP: Hypertext Preprossesor

Yup: it's a recursive acronym, meaning the first letter of the acronym stands for the acronym itself  tongue

At first, PHP was actually 'Personal Home Page' because it was intended to help users make their own interactive homepage. Now, the developers of PHP 2.0 (I think) changed it to something more significative.

Offline

 

#10 2011-11-11 16:37:45

Espevoir
Scratcher
Registered: 2011-05-22
Posts: 16

Re: Can somebody (or somebodies) Explain Php?

Thanks everybody  smile  That helped alot.

Offline

 

Board footer