Skip to content

Tag: php

Create a folder if it doesn’t already exist

I’ve run into a few cases with WordPress installs with Bluehost where I’ve encountered errors with my WordPress theme because the uploads folder wp-content/uploads was not present. Apparently the Bluehost cPanel WordPress installer does not create this folder, though HostGator does. So I need to a…

php setcookie domain

Some application, not written by me, and not in PHP, creates a cookie for the domain “www.domain.com”. I am trying to replace that cookie. So in php I did: setcookie(‘mycookie’,’mydata’,time() + 2*7*…

Lightweight PHP5 based template class/system

Looking at using a template system for a new project, it’s only a small site and don’t want to use the overhead and ‘complexity’ of smarty. I don’t really like template systems that force you to make use of another language just to make it easier for designers (apparently). Somet…

Decimal validation + PHP?

How to do decimal number validation in PHP? (The decimal point is optional) it should accept … 0 , 1 , 2 , 0.123 , 0.2 , 12.34 etc. Answer Would any of these suit your needs? is_float() is_numeric()