Skip to content

php header location vs php_redirect

What’s the difference between the function “HTTP_redirect” and “header location” in PHP ? When must I use the function “HTTP_redirect” ? When must I use the function “header location” ? Look that: https://php.net/manual/en/function.http-redirect.php &#8211…

Are preg_match() and preg_replace() slow?

I’ve been coding in PHP for a while and I keep reading that you should only use preg_match and preg_replace when you have to because it slows down performance. Why is this? Would it really be bad to …

Convert tiff to jpg in php?

I have a server which holds TIFF images. Most clients can read and display TIFF images, so there’s no problem. However, some clients can’t handle this format but can handle JPG. I thought of using PHP’…

FTP upload via PHP form

I want to upload a file via FTP upload in a form. Here is the PHP file: The FTP connection connects successfully but the file is nowhere. Can anybody help me? Thanks! Answer Because you have <input name=”uploadedfile” type=”file” />: Because you need the filename of the temporary…

How to create a custom JSON layout from MySQL in PHP

I have a MySQL query in PHP that pulls back two columns of results Column One is Label Column Two is Value I have read http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP but im struggling to understand how I can do the following JSON in PHP from MySQL I can manually write a loop to output the raw text to …

Using the “new” keyword in constructors

I’ve recently read that using the keyword “new” in a constructor is highly frowned upon, but I’m not sure I understand why? For example, how is: class A { public $foo; function __construct() …