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!
|
|
tc4me
December 17th, 2024
Blablablabla
|
|
tc4me
December 17th, 2024
Blablablabla
|
|
tc4me
December 17th, 2024
Blablablabla
|
|
tc4me
December 17th, 2024
Blablablabla
|
|
tc4me
December 17th, 2024
Blablablabla
|
View all updates
|
Online Users |
There are currently 341 online users. » 0 Member(s) | 340 Guest(s) Google
|
|
|
PHP - Part 6 |
Posted by: Darth-Apple - November 8th, 2013 at 2:33 AM - Forum: Software
- Replies (2)
|
|
How to Program PHP
Tutorial, Part 6
Welcome to part 6 of this series of tutorials! In the last tutorial, we finally introduced some concepts that allowed you to interact with a PHP script on the server. (That was a lot of tutorials to get to something so simple, eh? ) In this tutorial, we will introduce the concept of the loop, which will be an extremely useful concept that we will use in later tutorials. These concepts will become especially important when we start using databases. We're still a good way off from that, but this is nevertheless a very important concept.
Basically, a loop does two very simple things. 1) It executes a block of code over and over again, and 2) it checks some sort of condition each time before it executes. The condition is very important because otherwise, without a condition, a loop would literally execute forever. In PHP, we aren't quite as worried about crashing a server because typically a PHP script is cut off after about 30 seconds of execution time (unless your webhost has an unconventional PHP configuration), but in other programming languages, the implications of "bad loops" could be a lot worse.
The first "loop" that will be demonstrated is the "while" loop, which looks like this:
Code: <?php
$count = 0;
while ($count < 11)
{
echo $count. "<br>";
$count = $count + 1;
}
?>
The above code is actually very simple. A "while" loop simply executes a block of code over and over again, as long as a specific condition is met each time. If you run this script, you will see the script count from 0 to 10 in your browser. What makes it stop at 10?
Notice how the condition of the while statement is "($count < 11)". Basically, the condition is that the $count variable is less than 11. If it is equal to 11 or more, this "while" statement will not execute. If it is less than 11, the while statement will execute, and will continue to execute as long as $count remains less than 11. Now of course it won't increment count by itself, so we'll have to make sure that we do that in our loop to prevent an "endless loop" that runs eternally.
Notice these lines:
Code: echo $count. "<br>";
$count = $count + 1;
The second line is what actually increments $count by 1. Every time this while loop executes, it will increment $count by 1 because this line is "in" the loop. The line before it simply echoes the value of the $count variable, so you will see it in your browser. It also adds a <br> tag so that each number is on each line, so don't be confused by that part of the statement. What you'll end up seeing in your browser when you run this script will be:
Quote:0
1
2
3
4
5
6
7
8
9
10
As you can see, the while loop is pretty simple. It is an extremely useful loop in PHP, and it will be important to have a solid understanding of how it works. Of course the while loop isn't the only kind of loop that PHP has to work with. There are several variants, including the do-while loop, which is a variant of the while loop where first the block of code will be executed once, and then it will check against a condition before it runs the loop any additional times. What's different about the do-while loop is that a do-while loop will always execute at least once. A while loop won't even execute at all if the condition is never met, but a do-while loop is guaranteed to run at least once, even if no conditions are ever met.
The do-while loop isn't as common as the while loop, so I won't cover it specifically in this tutorial, but if you would like to learn more about how it works, click here for the official explanation from the online PHP manual.
There are of course several other loops in PHP, but none of them are as essential. One loop that I will cover later on is the for loop. The for loop is like the while loop, but it increments the variable automatically instead of requiring you to make a statement to increment a variable. (this sounds useful, but all it really does is save you one extra line of code. ) There is nothing that can be done with a for loop that cannot be done with a while loop, so this isn't very essential for us to glance over yet. If you would like to gain a better understanding of a for loop now, feel free to look at this page from w3schools.
This has been a fairly short tutorial. In my post below, I will give a more "interactive" example of the while loop, and in future tutorials, we'll continue to dive into more complex concepts.
|
|
|
Cloud Hosting - NShadow CDN |
Posted by: NightShadow - November 7th, 2013 at 6:58 PM - Forum: Technology & Hardware
- Replies (3)
|
|
So, to compliment the release of ShadowPost (my social network software) in March, I had an idea (soon to be project if funding is secured) to start up a small cloud host with affordable prices. It will mainly host ShadowPost communities but can aim at sponsoring established open source projects.
The three locations I had in mind for servers were:
Chicago Area (Continuum DC in Lombard, IL)
Dallas (CoreXchange in Dallas, TX)
Denver (Handy Networks in Denver, CO - COMING SOON)
Here is a map of the locations also:
http://nshadowcode.net/serverloc.png
It will be a KVM/CloudStack powered cloud with a custom panel (though with Solus at the start possibly?), and price at a flat rate instead of per hour, and have fair overages if needed, such as $2.50 monthly for 10GB of space, etc.
All bandwidth would be unlimited on a shared 100Mbps line, in which the user can upgrade to 1Gbps for $25/mo. Hard drive space is RAID 5 protected with SSD caching coming soon.
Open source project sponsoring would equal free or low-price hosting for mid-to-large sized open source projects, that may have outgrown SourceForge or GitHub for example. It would all depend on what the project managers need, for example, we could offer a site for free, and a mirror for software downloads possibly for $5-20/mo.
What do you think?
|
|
|
Ello :> |
Posted by: Abi - November 6th, 2013 at 3:04 AM - Forum: Introductions
- Replies (4)
|
|
Hello,
My name is Stephanie and im from Canada.
Im currently just a 2nd year student at SAIT Polytechnic studying new media production and design. I can be quite shy at times, but i tend to be quite talkative if we have something in common.
Im mainly a traditional/digital artist but i've taken quite an interest in graphic design and web development.
Besides that i like to play video games, read and of course; doodle. My interests are fantasy, sci-fic (robots specifically), and crafts.
Thats it i guess, cya around :]
|
|
|
Fonts? |
Posted by: Darth-Apple - November 6th, 2013 at 1:58 AM - Forum: Photography & Graphics
- Replies (40)
|
|
Fonts can make a surprisingly big difference on the overall appearance and feel of any logo, signature, ad, or anything else of that nature. I personally will easily spend a lot of time trying out different fonts and looking with different contexts to see which ones I prefer to use in my designs.
Right now, Verdana and Lucida Handwriting are my favorites. As for the others that are available, I usually just "feel them out" and try whatever looks nice.
What are the fonts that you find yourself using frequently in graphics design?
|
|
|
|