Posts Tagged ‘ scripting ’

Why use an array?

Recently, I asked myself the same question.  You might be wondering, what is an array.  According to Wiki:

In computer science an array [1] is a data structure consisting of a group of elements that are accessed by indexing.

What does that  really mean?  Well, I’ll explain by using an example I got off one of the programming forums I frequent, SamponVideos.com. I will actually quote some of Johnathan Sampson’s message because it captures the idea.  In his example, if you were creating a an image uploader, and you did not want to allow executable files, you would do something like this:

$fileTypes = array("jpeg","gif","jpg","bmp");

Without the use of an array, it would turn into this:

if ($fileExtension == “jpeg”) {
# Approved
} else
if (
$fileExtension == “gif”) {
# Approved
} else
if (
fileExtension == “jpg”) {
# Approved
}

Or this:

if ($fileExtension == “jpeg” || $fileExtension == “gif” || $fileExtension == “jpg”) {
# Approved
}

The array makes the code, much easier to handle, and looks cleaner.  Have you used arrays in your projects?

Category: PHP Script | Comments Off on Why use an array?

What are PHP and ASP.net?

Recently, I have been having alot of questions about what PHP and ASP.net are and how do they help on a site.

What are PHP and ASP.net? Why do I care?

1. What are PHP and ASP.net?

1. Well, when you want to use a shopping cart, forum, or anything outside of a static website it requires the server to do something. For example, this blog is written in PHP, because I can add blogs and I do not have to edit the html code.

2. What’s the difference between PHP and ASP.net?

1. PHP generally is used by people like us, who design and build websites.

2. ASP.net is generally used by big corporations. They like ASP.net because it is backed and supported by Windows.

3. Now, why do you care?

1. Does your business want to sell products online?

2. Do you want a forum or other social networking system? (Facebook, Myspace, YouTube, etc.)

3. These types of sites require the server to handle parts of your site because html can not do it alone.

 

»crosslinked«

Category: Hosting | Comments Off on What are PHP and ASP.net?

|

Flickr Photos

Quick Contact

Your Name (required)

Your Email

Your Message

captcha