Tags: namespaces php

PHP Namespace Syntax: What is the Difference with Braces vs. without Braces?

Tags: ,


PHP offers two syntax for declaring namespaces. You can use a namespace with no braces or with braces as seen below. Without Braces namespace foo/bar; class Any{} With Braces namespace foo/bar { …

mysql custom global defined variable

Tags: , ,


In my database design, I tend to store some variable that is meant to be acting as a ROLE or TYPE as SMALLINT. For example : CREATE TABLE `house` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` …

Merging a general wordpress search with a woocommerce product search?

Tags: , ,


I am using the following two codes to generate a wordpress search and a woo commerce product search? Is there a code to merge theme into one search bar doing both functions? <?php …

PHP Mail header for emails with special characters in the subject or message

Tags: , , , ,


My code: $to = ‘example@example.com’; $subject = $_REQUEST[‘subject’] ; $message = $_REQUEST[‘message’] ; $header = “From: noreply@example.comrn”; $header.= “MIME-Version: 1.0rn”; $header.=…

Object-Relational Mapping vs Database Abstraction Layer

Tags: , , , ,


I’m using Doctrine which provides both ORM and DBAL. What is difference between them? How should one decide when to use which?

Custom mysqli prepare function

Tags: , , , ,


I’m doing my first own database class at the moment and currently I’m doing the prepare function. What this function does is to take in an SQL-query and then an array containing the variables for the …

rewrite url and let more parameters

Tags: , , ,


I am rewriting this kind of urls http://deia.info/category/calendar/10/ To /index.php?task=browse_posts&catid=$2 By this code in the .htaccess RewriteRule ^category/(.+)/(.+) /index.php?task=…

Date and time in Greek

Tags: , ,


I’m currently using a website to get the time in Athens: $d = new DateTime(“now”, new DateTimeZone(“Europe/Athens”)); echo $d->format(“l, d M Y”); But I would like the date to be displayed in …

Tags: php regex

Replacing text between two limts

Tags: ,


I have been trying to get the text between two symbols to be replaced with preg_replace, but alas still not quite getting it right as I get a null output that is empty string, this is what I have so …