Archive for the 'PHP' Category
How to use PHP in pages with a .html extension (or any other)
5 Comments Published 2 years, 5 months ago in Basics and PHPTo be able to use php code on a page with an extension other than .php, you need a server which supports .htaccess files.
To add an extension to be parsed for php, create or edit a file called .htaccess (with the dot first) containing the following line:
AddType application/x-httpd-php .html .moo .htm
This tells the server […]
The Difference Between require() and include()
6 Comments Published 2 years, 5 months ago in Basics and PHPThe key difference between require() and include() is that if you require() a file that can't be loaded (eg if it isn't there) then it generates a fatal error which will halt the execution of the page completely, and no more output will be generated. On the other hand, if you include() a file that [...]
The problem: we have an array of items in PHP and we want to find out if a specific item is in the array. In code we can define the array as:
IE we have an array called $fruitBasket which contains 5 strings, each of which is the name of a fruit. We want to find [...]
This tutorial will show you how to rotate an image in your PHP scripts. You'll need to have the GD library installed to be able to use some of the functions we use in this guide, though this is included with most PHP installations so there's a chance you'll have it.
Image rotation in PHP is [...]
PHP provides three built-in functions which allow you to easily read the contents of a file on your webserver. This is useful when, for example, another program may write information to the file and you could access that information through your script.
In this example, we're going to use the following example 5 line file, saved [...]
To create random numbers in PHP, you can use the rand() function call, which takes either zero or, optionally, two parameters determining the minimum and maximum random numbers (inclusive) that you'd like. If you don't specify a maximum then it will default to a value, RAND_MAX, set in the PHP configuration. The function returns an [...]
The full URL to a page comes in three parts: The domain name, the path to the file then the filename, and the query string. For example, take the URL http://www.example.com/example/page.php?name=Bob. The three parts of this are:
1. The domain name: www.example.com2. The path to the page: /example/page.php3. The query string: name=Bob
So how do you find [...]
Do you want to know the IP address of a visitor? This can be useful for many reasons, such as tracking site usage or blocking access to specific people. Here's how you can find it using PHP.
In a PHP page, within the PHP tags, <?php ... ?>, you can retrieve the IP address of a [...]
| ||||
Search
About
You are currently browsing the DiscoMoose weblog archives for the 'PHP' category.
Longer entries are truncated. Click the headline of an entry to read it in its entirety.Categories
- ASP (3)
- ASP Basics (3)
- Blogs (2)
- C# (1)
- deals (1)
- Firefox (1)
- Flash (1)
- Google (6)
- Hacks (4)
- Java (1)
- PHP (12)
- Basics (8)
- Files (1)
- Image Handling (3)
- Puzzles (1)
- Ruby (1)
- Tips (10)
- Web Hosting (3)
- Web Hosting Articles (1)
- Web Hosting News (2)
- Windows (6)
- Wordpress (2)
Latest
- Iiyama 24″ monitor
- Deal: HP Photosmart C4280 under £45 on Amazon
- Brainteaser: Which letter comes next?
- Hacking the translation plugin for nicer URLs
- How to Access a Page in Google’s Cache
- How to Control the Mouse Pointer Without a Mouse in Windows XP
- Use Google to define words
- List all processes with the Windows Command Line
- Kill a Process from the Windows Command Line
- Google: Search within a site
Archives
Categories
- ASP (3)
- ASP Basics (3)
- Basics (8)
- Blogs (2)
- C# (1)
- deals (1)
- Files (1)
- Firefox (1)
- Flash (1)
- Google (6)
- Hacks (4)
- Image Handling (3)
- Java (1)
- PHP (12)
- Puzzles (1)
- Ruby (1)
- Tips (10)
- Web Hosting (3)
- Web Hosting Articles (1)
- Web Hosting News (2)
- Windows (6)
- Wordpress (2)
