Welcome, Guest
Welcome to Makestation! We are a creative arts/indie discussion community — Your center for creative arts discussion, unleashed!

Please note that you must log in to participate in discussions on the forum. If you do not have an account, you can create one here. We hope you enjoy the forum!

Status Updates
Avatar of User
tc4me December 26th, 2024
Müll!
Avatar of User
tc4me December 26th, 2024
Müll!
Avatar of User
tc4me December 26th, 2024
Müll!
Avatar of User
tc4me December 26th, 2024
Müll!
Avatar of User
tc4me December 26th, 2024
Müll!
View all updates

Search Forums

(Advanced Search)

Forum Statistics
» Members: 959
» Latest member: samarajoyit25
» Forum threads: 4,654
» Forum posts: 28,903

Full Statistics

Online Users
There are currently 375 online users.
» 3 Member(s) | 370 Guest(s)
Bing, Google, AbHadu, Hamu21, op_akansha

Latest Threads
Temu Coupon $100 Off [acp...
Forum: Lifestyle
Last Post: AbHadu
Less than 1 minute ago
» Replies: 0
» Views: 1
Temu Coupon Code 40% Off ...
Forum: Lifestyle
Last Post: AbHadu
1 minute ago
» Replies: 1
» Views: 8
Temu Coupons [acp856709] ...
Forum: General Discussion
Last Post: AbHadu
2 minutes ago
» Replies: 0
» Views: 1
Temu Coupon Code $100 Off...
Forum: Community Related
Last Post: AbHadu
3 minutes ago
» Replies: 0
» Views: 1
Temu Coupon Code 30% Off ...
Forum: Creative Arts/Indie Discussion
Last Post: Hamu21
4 minutes ago
» Replies: 0
» Views: 1
Temu coupon code $100 off...
Forum: Announcements
Last Post: AbHadu
4 minutes ago
» Replies: 0
» Views: 1
Temu Coupon Code $100 Off...
Forum: Community Archive
Last Post: Hamu21
15 minutes ago
» Replies: 0
» Views: 2

 
  favorite graphics program?
Posted by: 3DWaffle1 - August 13th, 2013 at 5:00 PM - Forum: Photography & Graphics - Replies (4)

What is your favorite graphics program? Do you use it often?

Print this item

  Site Map for MyBB?
Posted by: 3DWaffle1 - August 13th, 2013 at 4:59 PM - Forum: MyBB Related - Replies (2)

Is there a mod for Site Map for MyBB?

Print this item

  PHP - Part 4
Posted by: Darth-Apple - August 13th, 2013 at 4:29 PM - Forum: Software - No Replies

How to Program PHP
Tuturial, part 4

So far, we've explored several fundamental concepts in programming. We've explored the echo statement, and how a PHP file needs to be structured in order for the server to run it. In the second tutorial, an overview was given on how to use variables and arrays. In the third tutorial, functions were introduced. Functions are an extremely fundamental concept in PHP, but it can take quite a while to get used to them. If you're still a little confused, keep reading. All of this will become more clear as you continue working through these tutorials.

In this tutorial, I will introduce the concept of conditional statements. Conditional statements allow us to run different parts of our code, depending on whether a certain condition is met. For example, what if you had a script that denies registration and leaves a message for the user if the user is under 13? Many forums for example are required to deny registration to users under 13 due to COPPA restrictions in US law, so this is a popular real-world example.

Now, you have some code that echoes "sorry, but users must be at least 13 years of age to register," but you need to actually check to see if the user is at least 13 years of age before you execute that code. How exactly would you do that?

PHP has a set of "conditionals" that allow you to check for certain conditions before executing a block of code.

Code:
if ($condition == 1) {
// execute this code
// this IF statement only executes the code in between the curly brackets, and it will only execute this code if the $condition variable is equal to 1.
echo "executing the IF statement code block now. ";
}

The code above won't actually do anything, but it does demonstrate that the code between the curly braces will only execute if the $condition variable is equal to one.

TIP: Notice carefully how there were two equal signs used in the IF statement for ($condition == 1). Why did we need two instead of one? Turns out = and == are different operators in PHP. if you just use =, it will try to set the $condition variable to 1 which obviously is not what we want. If you use ==, instead of trying to assign a value to the variable, it will check its existing value, which is obviously what we want. Generally, you will always use == instead of = in conditionals for PHP.

Now, the code inside of the IF statement will only execute if the $condition variable is equal to 1. What if we want to execute a separate block of code if the $condition variable IS NOT equal to 1? In this case, we'll use an IF statement, and then and ELSE statement.

Code:
if ($condition == 1) {
// execute this code
// this IF statement only executes the code in between the curly brackets, and it will only execute this code if the $condition variable is equal to 1.
echo "executing the IF statement code block now. ";
}
else {
// this ELSE block will ONLY execute if the IF block does not execute. Basically, if $condition is equal to 1, PHP will execute the code inside of the IF block. If $condition is equal to anything OTHER than 1, it will execute the code in the ELSE block instead.
echo "executing ELSE block code now!";

}

As you can see, we've made use of the "else" block above. Simply put, the code in the "else" block will only run if the "if" block fails to run. If $condition is equal to anything other than 1, the else block code will run. If the $condition variable is equal to 1, the "if" block code will run. In no circumstance will both blocks of code ever run together.

So, what if it turns out that you need to execute a block of code if $condition = 1, a separate block of code if $condition = 2, and yet another separate block of code if $condition is equal to anything else? Turns out PHP has the "IF ELSE" block for that.


Code:
if ($condition == 1) {
// execute this code
// this IF statement only executes the code in between the curly brackets, and it will only execute this code if the $condition variable is equal to 1.
echo "choice 1 has been selected! ";
}
if else ($condition == 2) {
// this block of code ONLY executes if the $condition variable is equal to 2.
echo "choice 2 has been selected! ";

}
else {
// this ELSE block will ONLY execute if the IF block does not execute. Basically, if $condition is equal to 1, PHP will execute the code inside of the IF block. If $condition is equal to anything OTHER than 1, it will execute the code in the ELSE block instead.
echo "Oops! We don't recognize your choice selection. An error has occurred. ";

}

As you can see, the first IF block only executes if $condition is equal to 1. The second "IF ELSE" block only executes if $condition is equal to 2. The last "ELSE" block only executes if neither of the previous two blocks of code executed. In other words, "ELSE" executes if your network of IF and IF else statements never "found a match".

There are actually other conditional statements in PHP as well. The "switch" statement is fairly popular, and there are try and catch statements as well. These aren't very important to the purpose of our tutorials and aren't essential to learning the basics of PHP, so we won't attempt to go over these in detail.

Anyway, back to the original script concept for denying user registration to users under thirteen...

Code:
if ($age < 13) {
echo "Sorry, but users must be at least 13 years of age to register. ";
// the < operator is the "less than" operator for PHP.
}
else {
processRegistration (); // runs a function that processes the user registration.
// This only runs if the user is 13 or over. If the user was under 13, the IF block above would have run instead of this block of code. Remember, in no circumstance will the "ELSE" block ever run if the IF block has run.
}

If you would like to play around with these scripts, copy and paste the code below and give it a try. Big Grin

Code:
<?php
// play around with the following variable
$age = 12;
if ($age < 13) {
echo "Sorry, but users must be at least 13 years of age to register. ";
// the < operator is the "less than" operator for PHP.
}
else {
processRegistration (); // runs a function that processes the user registration.
// This only runs if the user is 13 or over. If the user was under 13, the IF block above would have run instead of this block of code. Remember, in no circumstance will the "ELSE" block ever run if the IF block has run.
}
?>

In the next tutorial, we will explore how HTML forms are set up and how we can design the first interactive applications. The fun stuff will be beginning soon. Big Grin

Stay tuned!

Next Tutorial: Let the fun stuff begin; forms and PHP introduction
Directory of PHP Tutorials

Print this item

  Nearforum (General forum)
Posted by: Tyler - August 13th, 2013 at 5:22 AM - Forum: Other Communites & Promotion - Replies (11)

Nearforum is a general forum so it contains a lot, a lot of places to post on hopefully satisfying everyone! This is my first time making a forums, so give me a break Tongue But we currently have 19 members and almost 90 posts! Darth-Apple uses it and he seems to enjoy it ^_^ So give it a go please!

Link: http://nearforum.com/index.php

Print this item

  What are your goals
Posted by: Tyler - August 13th, 2013 at 5:19 AM - Forum: General Discussion - Replies (3)

What are your goals for your websites, forums, blogs ect?

I'd love to hit 50 members and than 100, I think 100 people is still a good amount even though some of these forums hit thousands, I'd be happy with 100. I'd also like to hit 1,000 posts. (my goals for now) if my forums is successful I'd love to hit 1,000 members and 100k posts. I'd also like to learn more on how to make my forums better (as this was my first time making a forums)

Print this item

  50 Members
Posted by: Gmdykfuiygh66476 - August 13th, 2013 at 4:23 AM - Forum: Announcements - Replies (17)

As of this post, we're 3 members away from 50, a very important milestone. This site has grown so fast and is so active, and it's great being a part of it Smile

Print this item

  Doctor Who
Posted by: Gmdykfuiygh66476 - August 13th, 2013 at 4:18 AM - Forum: Media & Entertainment - Replies (13)

So, Matt Smith, the Eleventh Doctor, is leaving. He played the role for three years. I personally admired how he managed to make himself seem much older than he really is, being even younger than the tenth one, David Tennant. Also, I just loved the bowtie Tongue

But I'm excited because a great candidate is taking his place, Peter Capaldi. My favorite thing about him is that he's over 40 years old. Honestly the people who are all upset that Tennant wasn't brought back and they're using some "old guy" instead get on my nerves. They say they won't be watching anymore - I certainly won't miss them Tongue

Any other Doctor Who fans here?

Print this item

  PHP - Part 3
Posted by: Darth-Apple - August 13th, 2013 at 12:38 AM - Forum: Software - No Replies

How to Program PHP
Tutorial, Part 3

Welcome to part 3 in this PHP tutorial! So far, we've explored basic concepts such as echo statements, and in part 2 we explored variables and gave a brief introduction to arrays. In this tuturial, we'll introduce yet another very fundamental concept in programming. Luckily, this isn't as complicated as it could be in PHP. This tutorial will introduce the concept of the function.

Chances are, you remember functions from Algebra 1. It's probably a term you are already familiar with, but what do functions actually do?

Well, suppose that in your program, you've written about 200 lines of code to verify a file, then upload it to a server. While you are originally writing this code, it is only needed in one part of the program, but as you continue to develop your software, you find out that this code that you have developed is extremely useful for many tasks in your program. Do you simply copy/paste or rewrite the code? You could do that, but it would turn into a massive mess of thousands of lines of code very quickly.

Furthermore, suppose that you find a massive security hole in your code and need to repair it immediately to protect very important data. If you have your code copied several times all throughout your software, you have to fix the hole several times, making it a difficult fix. What's the solution to the delima? A function, of course! A function allows code to be reused.

In PHP, you first must define a function. When you define a function, you give it a name and put some code inside that will be executed. In PHP, a function will only be executed when it is "called". We'll see how this works through some examples.

Code:
<?php

function sendGreeting () {
echo "hello world! <br>";
}

?>

This code is pretty much useless. It's not like we'll be reusing the "hello world" echo statement a whole lot in any real projects, but this code is valid code, and it does define a function. If you run this script on your own, you will notice that nothing happens. Why isn't "hello world" appearing on your screen?

In the code above, we defined the function, but we never "called" it. PHP will never execute a function before it is "called".

Code:
<?php

function sendGreeting() {
echo "hello world! <br>";
}

sendGreeting();
?>

The only difference in the code above from our original code is the sendGreeting(); line. This line "calls" the sendGreeting function that we defined before. Run this code in your browser, and you will notice that "hello world!" now appears on your screen.

Code:
<?php

function sendGreeting() {
echo "hello world! <br>";
}

sendGreeting();
sendGreeting();
sendGreeting();
sendGreeting();
?>

You probably notice that we are calling the sendGreeting function multiple times in the code above. This is perfectly legal in PHP. The really cool thing about functions is that it basically allows you to reuse code anywhere in your program without having to rewrite it. That's what makes it possible to send you four greetings without four echo statements.

Functions can do a lot more than just send greetings. It turns out that every function can take paremeters, and it can return a value. Now, before you get confused about peremeters and return values...

A paremeter is: just a variable that you send to the function.

A return value is: Just a variable that the function sends back to the script that had called the function.

It turns out that both concepts are incredibly useful. Suppose we want to have two kinds of greetings, but we want to save code and define only one function. Well, since we can pass paremeters to the function, we can pass a number to define which greeting to use.

Code:
<?php

function sendGretting($selector) {
if ($selector == 1) {
echo "hello world! <br>";
}
else {
echo "why hello there! This is greeting number 2!<br>";
}

return "success printing greeting!";
}

$status = sendGreeting(1);
echo $status;
?>

First, you may notice something new. I haven't talked about the "if" and the "else" statements before. I won't attempt to explain what these do in detail until later tuturials, but these are basically conditionals that only execute code under certain conditions. Basically, if the $selector variable is equal to 1, it will send the first greeting. If it is not equal to 1, it will echo greeting 2 instead. In this code you will see

Quote:hello world!
success printing greeting!

On your screen when you execute this script.

So... what about the "success printing greeting!" Where did that come from? Is "return" some kind of echo statement?

A return value is just some variable that the function sends back once it is done executing. In this case, we just return "success printing greeting!" When we call the function, notice that we have the $status = in front of the actual function. Basically, whatever the function returns will get stored in the $status variable. Because the function returned "success printing greeting!", $status contains "success printing greeting!" and when we echo $status, you see "success printing greeting!" on your screen.

The function is an incredibly useful concept in programming. In the next tutorials, I will further introduce conditionals, which will be a very useful concept later on.

Next Tutorial: Conditional Statements
Directory of PHP Tutorials

Print this item

  PHP - Part 2
Posted by: Darth-Apple - August 13th, 2013 at 12:37 AM - Forum: Software - Replies (2)

How to Program PHP
Tutorial, Part 2


Welcome to part 2 in this PHP tutorial tutorial! In the previous tutorial, we explored the basic "echo" statement, and some pretty fundamental concepts in PHP statements, such as the semicolon at the end of every statement. In this tutorial, we'll explore variables, which are a pretty fundamental concept that we'll be using later on for interactive applications.

When many people see "variables" in the context of computer programming, algebra quickly comes to mind. Don't worry, you won't need to brush up on your mathematical equations. Variables are a simple concept in programming. Tongue

What is a variable?

A variable is essentially just a container that has a value. Yes, these variables have real world applications in algebra, but we won't be getting into sines, cosines, quadratic equations, derivatives, or anything else of that sort. As far as we're concerned, a variable simply holds a value for later use.

Variables in PHP are destroyed as soon as the script is finished executing, so they don't store data long term. If you need to process factory orders or user registrations, a database will be required for that. Nevertheless, variables are very much an important concept that will be foundational to every PHP application. Tongue

Code:
<?php
$var1 = 5;
$var2 = 9;
echo "var1 + var2: ";
$result = $var1 + $var2;
echo $result;
?>

Following yet? Yes, that looks like giberish. Tongue

Variables always start with a dollar sign in PHP ($), so you should be able to recognize where the variables are just by looking at the above code. As you can see, in the first two lines of this code, we simply define $var1 to be 5, and $var2 to be 9. These are the values that these variables contain. We could have named these variables anything. We did not have to name then $var1, $var2, etc... We could have called them $apple, $banana, etc... and they would have functioned exactly the same way.

The next statement is just an echo statement. You may be tempted to think that this first echo statement will add var1 and var2, sending 14 to the browser for you to see on the page, but remember that because the text is in quotes, this is just a text string. Since we're only sending a text string, you will literally see "var1 + var2: " in the browser from this statement.

The next statement adds $var1 and $var2, then puts the answer into the $result variable. Remember, we defined $var1 to be equal to 5, and $var2 to be equal to 9. When we add them, they will equal 14, and that answer goes into $result. As stated before, these variables could have been named anything. It's always wise to keep variable names as descriptive as possible in programming, as it does help a lot when you start writing larger scripts confidently. To be honest, $var1 and $var2 aren't the most descriptive names, but you see the idea.

The next statement echoes $result, which of course equals 14 and is displayed in the browser. I encourage you to try this script yourself on your own server or WAMP. Try playing around with it some to get a feel for it. Variables are an important concept in PHP, and they are very simple once you get the hang of it.

More examples

There is quite a lot that is possible with variables, well beyond simply adding numbers. Here is another example. I encourage you to try this script out on your own, playing around with the different numbers and math operators to get a feel for how it works.

Code:
<?php
$apples = 5;
$oranges = 995;
$cucumbers = 3;
$result = $apples + $oranges + $cucumbers;
echo "total fruits: ";
echo $result;
echo "<br>"; // the <br> tag is the HTML tag for a new line.
$good_fruits = $result - $cucumbers; // we don't like cucumbers.
echo "Since we don't like cucumbers, the number of good fruits is: ";
echo $good_fruits;
?>

As you can see, we've played around with the math in these statements, using some addition and subtraction. I encourage you to try these scripts out on your own to get a feel for how variables work in use.

Text in variables

In algebra, variables always contained numbers. In programming, variables can contain practically anything. Some kinds of variables (which we'll get to later) can even contain files. Often, you'll see variables with text in them. PHP deals with text variables the same way that it deals with variables containing numbers. (Just don't try to perform a "text string" + "text string #2" addition operation. I've never really tried that to see what exactly PHP says about that, but I'm sure you will get some sort of complaint about attempting a math operation on text. Tongue )

Code:
$mytext = "this is a text string inside of a variable";

Arrays

So that's more or less the basics, but there is more to variables that needs to be said. An array is a concept we'll be using very shortly that makes it very simple to organize data if you have a lot of data to organize. Essentially, an array is a variable that contains more than one value. Here is how arrays look in code:

Code:
<?php
$fruits['apples'] = 5;
$fruits['oranges'] = 9;
$total_fruits = $fruits['apples'] + $fruits['oranges'];
echo $total_fruits;
?>

As you can see, both the number of apples and the number of oranges are stored into the "fruits" variable, but we've made use of an array. In an array, each individual "value" that it stores is called an element. Here, 'oranges' and 'apples' are both elements of the array that is called $fruits. $fruits['oranges'] = 9 is a statement that sets the "oranges" element in the array to 9. It won't affect the "apples" element since "apples" is in a different part of the array. Also, notice how 'oranges' and 'apples' are in brackets. Arrays always have to structured like this so that PHP knows that you are referring to an array in code. Arrays may not seem necessary in this particular situation, but they will become very useful later.

It turns out arrays don't just have to have text in the brackets. We could have used numbers as well.

Code:
<?php
$fruits[1] = 5;
$fruits[2] = 9;
$total_fruits = $fruits[1] + $fruits[2];
echo $total_fruits;
?>

The code above functions exactly the same way as the original arrays example does. If you run this script in your browser, you will see the exact same result. The only difference is that we identified the different "elements" of the $fruits array with numbers instead of with text strings. Either way is valid in PHP, although for this particular example, it is much more practical for us to use text strings instead, for obvious reasons. Tongue

Arrays can be incredibly useful when it comes to some applications. Two variables, to be specific, are very important to dealing with HTML forms. We'll be dealing with $_GET and $_POST arrays later on, but these are basically arrays that contain the values of URL fields and form fields, and we'll be getting to those later on.

The next tutorial...

In the next tutorial, we'll be building on more concepts putting these variables to use. We'll introduce the function. stay tuned!

Next Tutorial: Introduction to Functions
Directory of PHP Tutorials

Print this item

  PHP - Part 1
Posted by: Darth-Apple - August 13th, 2013 at 12:36 AM - Forum: Software - Replies (4)

How to Program PHP
Tutorial, Part 1

Ever wanted to get your feet wet with a programming language, but simply haven't had the money to pay for expensive books or online courses? Of course, any programming language takes time to master, but I will attempt to cover the introduction to the PHP programming language through these tutorials. I'm living proof that you don't need an $80 manual to learn a programming language. Due to the fact that I can't write 400 pages worth of really awesome content effectively without writing a book, I won't attempt to dive into concepts that are too deep, but I hope I'll be able to give you a good introduction to the language. If you'd like to go further, w3schools is a great reference resource that I've used, and once you've gotten your feet wet, it is a great resource to use if you want to continue past these tutorials.

I'm assuming that anyone reading this already has a good understanding of basic HTML, and at least knows what they are looking at if they see some javascript. If you are not at this stage, I won't attempt to review any HTML in these tutorials, so I'd recommend taking a good HTML course first. I would personally recommend codeacademy.com if you are completely new to HTML, but if HTML is not new to you, then we're ready to dive in!

PHP introduction - part 1

What exactly is PHP anyway?

PHP is a programming language that runs straight from the server, and is used to power many websites. Forum software, social networking solutions, or any other software solution that works with dynamic content will usually use PHP (or a similar language) to generate a page, then will send it to the browser. PHP is extremely useful for that reason. It differs from HTML because it is not a markup language that simply defines the format that a page is sent to the browser with. PHP is a programming language that can be used to generate the HTML pages sent to the browser.

Of course, there are alternatives as well. PHP is probably the most common language used to achieve its task (for non enterprise use, at least), so this will be the first tutorial I will write here at Makestation.

Hold on, prep work first! ( skip this section if you already have a server or localhost )

While you certainly might be able to get familiar with some concepts you haven't seen before by simply reading these tutorials, you are much more likely to get the hang of any programming language by actually following along with the tutorials with your own scripts. You do not need to have a server to write and execute PHP scripts. For windows users, I recommend installing wampserver to your computer, which will allow you to run PHP files straight from your computer. If you cannot get wampserver to work, a simple free webhost such as zymic or 000webhost should be enough for this project. (Be sure to read your webhost's terms of service carefully if you choose to go that route. )

I would strongly recommend setting this up before continuing so that you can follow along with these tutorials with your own scripts. If you are a windows user, WAMP is probably the easiest route. Once you have that set up, simply copy/paste the scripts that are posted here into a .php file inside of the c:/wamp/www directory, and as long as wampserver is started on your computer, you can go to localhost/myfilename.php in the browser of your choice to execute it.

Your first PHP script

I've seen quite a few tutorials that spend quite a bit of time teaching the theory behind a concept before actually jumping to the concept itself. Personally, I'm the kind of guy who likes to just jump straight into something and see stuff happen, so I won't be wasting too much time. In these tutorials, I will try to give a brief introuction, go straight to the code, then explain it afterwards. If something looks a little confusing, don't worry. Just keep reading, and I'll explain it later on. So, without wasting time, here will be your first PHP script.

Code:
<?php
echo "this is my first php script!";
?>

The first thing that is important are the <?php an the ?> tags. Simply naming a file .php isn't enough for PHP to actually execute the code as PHP. Without the <?php and ?> tags, the PHP server will assume that your file is actually an HTML file that is simply named as PHP file. In other words, all PHP code must be enclosed in the opening and closing PHP tags in order for it to actually be executed by the server.

The echo command is the command that sends data to the browser, which in this case is the "this is your first php script" message. This command is probably the most important command in PHP, since it's what sends data generated by the PHP script to the browser. (As stated before, no PHP code actually gets sent to your browser. PHP is all processed on the server, so all that the browser will ultimately receive is an HTML page generated and sent by the PHP script. )

Also, notice the semicolon (the ; character) at the end of the line. This character must go at the end of every statement in PHP. It essentially tells PHP that this command is complete, and that it is ready to execute. If the semicolon is missing, PHP will get confused and flag an error instead of executing the PHP code. It turns out that a missing semicolon is one of the most common errors in code that PHP programmers make. Whenever I see an error in my code, the first thing I'll usually check for is a missing semicolon.

Example 2:

Code:
<?php
echo "this is line #1";
echo "this is line #2";
echo "Why are you still reading this? ";
echo "forget it! PHP is easy! ";
?>

As you can see, we've made use of more echo statements. Each one has a semicolon at the end of it to mark the end of the command. If the semicolon is removed, PHP will get confused as it executes the code because it won't know where the end of the statement is. Also, notice again how all code is inside of the <?php and ?> tags.


Introduction to PHP - part 1.5

We've just gotten into the absolute basics of how a PHP file could be structured, what we need to do in order to get it to execute, and how to send text to the browser, but there are a few other quick concepts we'll need to dive into before we enter the next tutorials. We'll be getting into more interesting concepts in the coming tutorials, but for now we need to make sure we understand what we need to know before moving on.

Anyway, the first concept we'll get into before heading into the next tutorials is the concept of the text string. This is really more a definition we'll be bringing up later. A text string is exactly what it sounds like. It's just a string of text. For example, for this line of code...

Code:
<?php
echo "hello world!";
?>
"hello world" is just a text string. Now there is nothing complicated about that, but what if we need to merge two strings into one string?

Code:
<?php
echo "string 1 is " . "going to be combined with string 2";
?>

Try running this script, and you will see "string 1 is going to be combined with string 2". Notice how the period between the two strings combined both strings into one. This is one of many "operators" in PHP that can manipulate data in different ways. PHP also has many additional operators. The simplest of these operators are the math operators (+, -, and so on... Tongue ) We'll get into more of these operators in the later tutorials. For now, I encourage you to try these scripts on your own to ensure you understand these concepts.

Either way, we'll probably be using the period to combine different strings quite frequently in later tutorials, so feel free to play around with the above example to get a feel for how it works.

PHP comments
In PHP, it is possible to make notes in the code without it actually executing as code. There are multiple formats that you can use to define any text in the code as a comment, but for these tutorials, we'll just put "//" at the beginning of the line. This tells PHP that the rest of the line is not code, so it will just skip over it. This is very useful for making notes to yourself about the code.

Code:
<?php
echo "hello world!";
// this is a comment! It will not execute, since we have two slashes at the beginning of the line.
?>

The next tutorial

In the next tutorial, we'll begin to explore variables. Once we get some basic concepts down in the next few tutorials, we can begin playing around with some interactive applications. Stay tuned! Big Grin

Next Tutorial: Introduction to Variables
- Directory of PHP Tutorials

Print this item


Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024