1--TEST-- 2Test gmstrftime() function : usage variation - Passing time related format strings to format argument. 3--FILE-- 4<?php 5echo "*** Testing gmstrftime() : usage variation ***\n"; 6 7// Initialise function arguments not being substituted (if any) 8$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); 9setlocale(LC_ALL, "en_US"); 10date_default_timezone_set("Asia/Calcutta"); 11 12//array of values to iterate over 13$inputs = array( 14 'Hour as decimal by 24-hour format' => "%H", 15 'Hour as decimal by 12-hour format' => "%I", 16 'Minute as decimal number' => "%M", 17 'AM/PM format for a time' => "%p", 18 'Second as decimal number' => "%S", 19); 20 21// loop through each element of the array for timestamp 22 23foreach($inputs as $key =>$value) { 24 echo "\n--$key--\n"; 25 var_dump( gmstrftime($value) ); 26 var_dump( gmstrftime($value, $timestamp) ); 27}; 28 29?> 30--EXPECTF-- 31*** Testing gmstrftime() : usage variation *** 32 33--Hour as decimal by 24-hour format-- 34 35Deprecated: Function gmstrftime() is deprecated in %s on line %d 36string(2) "%d" 37 38Deprecated: Function gmstrftime() is deprecated in %s on line %d 39string(2) "08" 40 41--Hour as decimal by 12-hour format-- 42 43Deprecated: Function gmstrftime() is deprecated in %s on line %d 44string(2) "%d" 45 46Deprecated: Function gmstrftime() is deprecated in %s on line %d 47string(2) "08" 48 49--Minute as decimal number-- 50 51Deprecated: Function gmstrftime() is deprecated in %s on line %d 52string(%d) "%d" 53 54Deprecated: Function gmstrftime() is deprecated in %s on line %d 55string(2) "08" 56 57--AM/PM format for a time-- 58 59Deprecated: Function gmstrftime() is deprecated in %s on line %d 60string(2) "%s" 61 62Deprecated: Function gmstrftime() is deprecated in %s on line %d 63string(2) "AM" 64 65--Second as decimal number-- 66 67Deprecated: Function gmstrftime() is deprecated in %s on line %d 68string(%d) "%d" 69 70Deprecated: Function gmstrftime() is deprecated in %s on line %d 71string(2) "08" 72