Skip to content

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

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 …