Skip to content
Advertisement

.htaccess files, PHP, includes directories, and windows XAMPP configuration nightmare

XAMPP makes configuring a local LAMP stack for windows a breeze. So it’s quite disappointing that enabling .htaccess files is such a nightmare. My problem: I’ve got a PHP application that requires apache/php to search for an /includes/ directory contained within the application. To do this, .htaccess files must be allowed in Apache and the .htaccess file must specify exactly

Loading .sql files from within PHP

I’m creating an installation script for an application that I’m developing and need to create databases dynamically from within PHP. I’ve got it to create the database but now I need to load in …

How to find the foreach index?

Is it possible to find the foreach index? in a for loop as follows: $i will give you the index. Do I have to use the for loop or is there some way to get the index in the foreach loop? Answer $key is the index of each $array element

How do I find the MIME type of a file with PHP?

I have an index.php file which has to process many different file types. How do I guess the filetype based on the REQUEST_URI? If I request http://site/image.jpg, and all requests redirect through index.php, which looks like this How would I make that work correctly? Should I test based on the extension of the file requested, or is there a way

Chaining Static Methods in PHP?

Is it possible to chain static methods together using a static class? Say I wanted to do something like this: $value = TestClass::toValue(5)::add(3)::subtract(2)::add(8)::result(); . . . and …

php String Concatenation, Performance

In languages like Java and C#, strings are immutable and it can be computationally expensive to build a string one character at a time. In said languages, there are library classes to reduce this …

When and why should $_REQUEST be used instead of $_GET / $_POST / $_COOKIE?

Question in the title. And what happens when all 3 of $_GET[foo], $_POST[foo] and $_COOKIE[foo] exist? Which one of them gets included to $_REQUEST? Answer I’d say never. If I wanted something to be set via the various methods, I’d code for each of them to remind myself that I’d done it that way – otherwise you might end up

Advertisement