Top Left Text cha

Website Development Services

DAY

d - The numeric day of the month with
leading zeros (01 to 31)
D - Short day abbreviation (three letters). Mon through Sun.
j - Day of the month without leading zeros ( 1 to 31)
l (lowercase 'L') - Full day name (Sunday through Saturday)
N - ISO-8601 numeric representation of a day of a week
(1 (for Monday) through 7 (for Sunday)
S - English ordinal suffix for the day of the month, 2 characters
(st, nd, rd or th. Works well with j)
w - The numeric day of the week. (0 (for Sunday) through 6 (for Saturday)
z - The numeric day of the year (0 to 365)

MONTH

F - Full month name. (January through December)
m - Numeric representation of a month with leading zeros (01 to 12)
M - Short month abbreviation (three letters). Jan through Dec
n - Numeric representation of a month, without leading zeros (1 through 12)
t -Number of days of a specified month (28 through 31)

YEAR

L - Whether it's a leap year (set 1 if leap year otherwise 0)
o - ISO-8601 year number
Y - Numeric year value in 4 digits (1999)
y - Numeric year value in two digits (1999 as 99)

TIME

a - Lowercase am or pm.
A - Uppercase AM or PM.
B - Swatch Internet time (000 through 999)
g - 12-hour format of an hour without leading zeros (1 to 12)
G - 24-hour format of an hour without leading zeros (0 to 23)
h - 12-hour format of an hour with leading zeros (01 to 12)
H - 24-hour format of an hour with leading zeros(00 to 23)
i - Minutes with leading zeros (00 to 59)
s - Seconds, with leading zeros (00 to 59)
u - Microseconds(numeric value) Example : 574925

TIME ZONE

e - The timezone identifier (Examples: UTC, Atlantic/Azores)
I - Whether the date is in daylights savings time (set 1 for Daylight Savings Time, 0 otherwise)
O - Difference to Greenwich time (GMT) in hours (Example: +0300).
p - Difference to Greenwich time (GMT) with a colon between hours and minutes (Example: +03:00).
T - Timezone abbreviation. (Examples: EST, MDT)
Z - Timezone offset in seconds. The offset for timezones west of UTC is always
negative, and for those east of UTC is always positive. (-43200 through 50400).

Comment (0) Hits: 79
I used this specifically to combat a problem with file downloads - when the user uploads them and adds special characters like '#', '?', etc.  Just a PHP preg_replace function, which uses RegEx...

$url = preg_replace("![^a-z0-9]+!i", "-", $url);

excl!hash## !@#$%^&().pdf becomes excl-hash-.pdf

You can replace the dash with nothing like below and it will just smash everything around the special characters together...

$url = preg_replace("![^a-z0-9]+!i", "-", $url);
excl!hash## !@#$%^&()d.pdf becomes exclhash.pdf
For me it was a little more complicated as it was a file upload that needed changed.  So I used the code below...

$uploadChunks = pathinfo($_FILES['upload']['name']);
$upload = preg_replace("![^a-z0-9]+!i", "-", $uploadChunks['filename']).'.'.$uploadChunks['extension'];
Comment (0) Hits: 151

Found this at Stack Exchange... very handy!

    <form name="car_form" method="post" action="doublevalue_action.php">
            <select name="car" id="car">
                    <option value="">Select Car</option>
                    <option value="BMW|Red">Red BMW</option>
                    <option value="Mercedes|Black">Black Mercedes</option>
            </select>
            <input type="submit" name="submit" id="submit" value="submit">
    </form>

PHP action:

    <?php
            $result = $_POST['car'];
            $result_explode = explode('|', $result);
            echo "Model: ". $result_explode[0]."<br />";
            echo "Colour: ". $result_explode[1]."<br />";
    ?>
Comment (0) Hits: 714

 

var_dump(get_defined_vars());

 

void var_dump ( mixed $expression [, mixed $... ] )

This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure.

In PHP 5 all public, private and protected properties of objects will be returned in the output.

Comment (0) Hits: 1270
<?php
    if(strstr($_SERVER['HTTP_USER_AGENT'],’iPhone’))
  {
       echo "I'M SORRY... YOU HAVE AN IPAD!!!";
  }
	else {
		echo "YOU DO NOT HAVE AN IPAD!!!";
	}
?>

 

Comment (0) Hits: 1376
<?php
   $search-string = "derpity derp";
   $arr = array("http://site1.com", "http://site2.com", "http://etc.com");
   foreach ($arr as $site) {
      $contents = file_get_contents($site);
      if ( strpos($contents, $search-string) !== false ) {
         echo "$site - code found.<br />';
      }
   }
   unset($site); 
?>

Comment (0) Hits: 1362
X