Skip to content

Send HTML in email via PHP

How can I send an HTML-formatted email with pictures using PHP? I want to have a page with some settings and HTML output which is sent via email to an address. What should I do? The main problem is to attach files. How can I do that? Answer It is pretty simple. Leave the images on the server and send

Getting all request parameters in Symfony 2

In symfony 2 controllers, every time I want to get a value from post I need to run: Is there any way to consolidate these into one statement that would return an array? Something like Zend’s getParams()? Answer You can do $this->getRequest()->query->all(); to get all GET params and $this->ge…

If string contains forward slash

How do i make a if statement which checks if the string contains a forward slash? $string = “Test/Test”; if($string …….) { mysql_query(“”); } else { echo “the value contains a …

Compiling the PHP stack with Clang

Is it possible yet to compile a full PHP stack – say Apache, PHP, Postgres and enough of the more commonly used libraries to cover ninety percent of sites – with Clang into LLVM bitcode? If so, are …

php file_get_contents – AFTER javascript executes

basically, I am trying to scrape webpages with php but I want to do so after the initial javascript on a page executes – I want access to the DOM after initial ajax requests, etc… is there any way …

Function like var_dump in php

I need a function like var_dump($object) in php The problem is that the Var_dump function print every thing on the screen and I just need the answer in a variable. I mean sth like $variable=var_dump($…

Order details not displaying (WooCommerce)

I’m having a strange issue with a site I’m designing. I’m using the WooCommerce system up and running and am using the Wootique theme. I’ve edited a bit but nothing too major, mostly just colours. What’s happening is, when I go to buy something and checkout, I am able to enter my…

PHP get UK local time from Server in different time zone

I have a web server which I do not know what the time zone is set to. it is now 10:49am in the UK, but when I run the following: The server returns the following time. Now I don’t want to just “Add” one hour onto the time because the time still needs to be correct when time moves forward

PHP variable “default value”

I want to get a value from the session, but use a default if it is not defined. And ofcourse I want to circumvent the PHP notice. You can write a function that does this Example in action Is there a way to do this without defining this function in every file? Answer From PHP 7, you can now use