Remove all linebreaks in PHP
If you are having problems with a string that keeps adding a line break when output from PHP to HTML then the following code will work wonders for …
Read Article →61 articles about php development, tools, and best practices
If you are having problems with a string that keeps adding a line break when output from PHP to HTML then the following code will work wonders for …
Read Article →Would you like to restrict PHPMyAdmin from being accessible to the whole world?
Firstly you need to SSH into your box if you are not on the local …
Read Article →I needed to do some work on a WordPress site a little while ago and all the admins were French – and I cannot speak French other than the popular …
Read Article →If you would like to replace all the spaces in an HTML string with so that you can render it out to the browser but you also want to retain current …
Read Article →You can use the PHP code below to check if an IP address is valid or not.
I needed this when building a form that accepted IP addresses as input for a …
Read Article →Call me ignorant, or call me an ignorant geek, but I used to think is_home() and is_front_page() was the same thing, until I experimented with them …
Read Article →PHP Error messages showing up in your web applications are a dangerous thing. Not only does it look unprofessional, but it is also a serious security …
Read Article →It is a script which allows clients to make procedural calls over the net.
As it says in the name, the encoding is XML and because it is used on …
Today I will show you a method to stop the traffic that a referrer site is sending your way, you may wonder why you would want to ignore traffic, …
Read Article →If you do not know what the Ternary operator is, or do not use it while you are coding, let me be the first to tell you how much you are missing out! …
Read Article →I noticed on some server setups I could not do the following inside a .htacess file:
<br> php_value upload_max_filesize 250M<br> php_value …
If you are running WordPress and have noticed a line under all your posts that says:
If you enjoyed this post, make sure you subscribe to my RSS feed! …
Read Article →Quite often you may need the ability to check what type of data type a variable is.
In most programming languages this is possible to do and is …
Read Article →In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it.
It is a simple way of transferring data between …
If you would like to show random numbers using PHP you can do this:
I needed this for generating unique lottery-style numbers for a contest page. The …
Read Article →$to = "[email protected]";
$subject = "SUBJECT";
$message = "<b>MESSAGE</b>";
$headers = 'MIME-Version: …
Read Article →
If you have an .htaccess file to control the flow of URI’s on your site you may want to look at adding a nice little “case …
Below is a Mail class I created in PHP, it requires 4 arguments on initiation of the class via the constructor and uses the method ->send() to send …
Read Article →I just finished adding an export xls (excel) export feature to a web application.
I used the PHPExcel Class from CodePlex, its really great to work …
Read Article →Getting “Parse error: syntax error, unexpected T_IF” in PHP?
Check if the preceding line ends with a ;
This is one of the most common PHP …
Read Article →I have a question for anyone that can answer it:
I create an .htaccess file in the root of a subdomain, but if I enter either of these two lines I get …
Read Article →I was trying to import a massive csv dataset into phpMyAdmin and it kept throwing error:
Invalid field count in csv input on line 1
This is quite …
Read Article →I think this may be the fastest way to get a list of all the directories in a given folder/directory using PHP.
I needed this when building a plugin …
Read Article →In php there are a few magic constants and I find FILE to be a very useful one.
It returns the full path and filename of the file in question.
Take a …
Read Article →