~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/date/tests/gmstrftime_variation7.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test gmstrftime() function : usage variation - Passing day related format strings to format argument.
 
3
--FILE--
 
4
<?php
 
5
/* Prototype  : string gmstrftime(string format [, int timestamp])
 
6
 * Description: Format a GMT/UCT time/date according to locale settings 
 
7
 * Source code: ext/date/php_date.c
 
8
 * Alias to functions: 
 
9
 */
 
10
 
 
11
echo "*** Testing gmstrftime() : usage variation ***\n";
 
12
 
 
13
// Initialise function arguments not being substituted (if any)
 
14
$timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
 
15
setlocale(LC_ALL, "en_US");
 
16
date_default_timezone_set("Asia/Calcutta");
 
17
 
 
18
//array of values to iterate over
 
19
$inputs = array(
 
20
          'Day of the month as a decimal number' => "%d",
 
21
          'Day of the year as a decimal number' => "%j",
 
22
          'Day of the week as a decimal number' => "%w"
 
23
);
 
24
 
 
25
// loop through each element of the array for timestamp
 
26
 
 
27
foreach($inputs as $key =>$value) {
 
28
      echo "\n--$key--\n";
 
29
      var_dump( gmstrftime($value) );
 
30
      var_dump( gmstrftime($value, $timestamp) );
 
31
};
 
32
 
 
33
?>
 
34
===DONE===
 
35
--EXPECTF--
 
36
*** Testing gmstrftime() : usage variation ***
 
37
 
 
38
--Day of the month as a decimal number--
 
39
string(%d) "%d"
 
40
string(2) "08"
 
41
 
 
42
--Day of the year as a decimal number--
 
43
string(%d) "%d"
 
44
string(3) "221"
 
45
 
 
46
--Day of the week as a decimal number--
 
47
string(%d) "%d"
 
48
string(1) "5"
 
49
===DONE===