Skip to content

Tag: php

Fatal error: Declaration of .. must be compatible with .. PHP

I’m getting the following error: What could be the problem? I can’t find it script: Answer Ishoppingcart::addToCart() states that the method does not take any parameter, while the implementation Shoppingcart::addToCart(Product $product) requires that a parameter of type Product must be passed into…

show only limited categories with a MySQL queries

I have a mysql database in which there is about hundreds of category for photo album. When i display the album using so it will display the last 10 categories but if i want to display only 15 categories in between from that hundreds of category what the query should be? i have try this. here its displaying th…

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…

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 …

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