Skip to content

PHP DOMDocument error Entity ‘nbsp’ not defined

I use DOMDocument for editing some HTML files, but some of theme have in their names spaces. So DOMDocument automaticly change the spaces to %20 and then can’t find them. This is how looks the error exactly: How to repair this error? Answer Use DOMDocument::loadHTMLFile() instead of load(). That’s…

Submitting a form using

I’m having a little trouble with this and can’t see what I’m doing wrong. I have this form: So when the user clicks the button it should submit the form then have this PHP to act upon the form (I know that the sql isn’t a prepared statement and is vulnerable to injections but this will…

PHP $_GET/$_POST via variable variables

I’m attempting to dynamically access both the $_GET and $_POST arrays, among others, using variable variables. The reason I’m trying to do this is so that I can perform similar actions on multiple arrays without needing to declare specific iterations for each. I’m reasonably sure this is pos…

Get YouTube video title in PHP

In one of my applications I am saving a YouTube video’s id… Like “A4fR3sDprOE”. I have to display its title in the application. I got the following code for getting its title and also it’s working fine. Now the problem is if any error occurred (in case of a delete of the video) P…

Delete folder in Amazon S3 using PHP

I just started trying out Amazon S3 for hosting my website’s images. I’m using the official Amazon AWS PHP SDK library. Problem: How can I delete all files located in a S3 ‘folder’? For example if I …

php array sorting with accents

I am using this to sort according to last name: But – when in last name is accent, e.g. Šiko, Áron, etc, these names are at the end. How can I sort it properly? Answer Use multi-byte string functions. There is a function called strcoll which seems to suit your needs. More info: On how to sort an array o…