cvs: phpdoc /pt_BR/functions datetime.xml dbase.xml dbm.xml
| From: | Egon Schmid | Date: | Mon, 16 Oct 2000 21:35:51 +0000 |
| Subject: | cvs: phpdoc /pt_BR/functions datetime.xml dbase.xml dbm.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969332504@lists.php.net to get a copy of this message | ||
eschmid Mon Oct 16 14:35:51 2000 EDT
Added files:
/phpdoc/pt_BR/functions datetime.xml dbase.xml dbm.xml
Log:
Next one. It's in the order Jade are looking for files.
Index: phpdoc/pt_BR/functions/datetime.xml
+++ phpdoc/pt_BR/functions/datetime.xml
<reference id="ref.datetime">
<title>Date and Time functions</title>
<titleabbrev>Date/time</titleabbrev>
<refentry id="function.checkdate">
<refnamediv>
<refname>checkdate</refname>
<refpurpose>Validate a gregorian date/time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>checkdate</function></funcdef>
<paramdef>int <parameter>month</parameter></paramdef>
<paramdef>int <parameter>day</parameter></paramdef>
<paramdef>int <parameter>year</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns true if the date given is valid; otherwise returns false.
Checks the validity of the date formed by the arguments. A date
is considered valid if:
<itemizedlist>
<listitem>
<simpara>
year is between 1 and 32767 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
month is between 1 and 12 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
<parameter>Day</parameter> is within the allowed number of
days for the given <parameter>month</parameter>. Leap
<parameter>year</parameter>s are taken into consideration.
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.date">
<refnamediv>
<refname>date</refname>
<refpurpose>Format a local time/date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>date</function></funcdef>
<paramdef>string <parameter>format</parameter></paramdef>
<paramdef>int
<parameter>
<optional>timestamp</optional>
</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns a string formatted according to the given format string
using the given <parameter>timestamp</parameter> or the current
local time if no timestamp is given.
</para>
<para>
The following characters are recognized in the format string:
<itemizedlist>
<listitem>
<simpara>
a - "am" or "pm"
</simpara>
</listitem>
<listitem>
<simpara>
A - "AM" or "PM"
</simpara>
</listitem>
<listitem>
<simpara>
B - Swatch Internet time
</simpara>
</listitem>
<listitem>
<simpara>
d - day of the month, 2 digits with leading zeros; i.e. "01"
to "31"
</simpara>
</listitem>
<listitem>
<simpara>
D - day of the week, textual, 3 letters; i.e. "Fri"
</simpara>
</listitem>
<listitem>
<simpara>
F - month, textual, long; i.e. "January"
</simpara>
</listitem>
<listitem>
<simpara>
g - hour, 12-hour format without leading zeros; i.e. "1" to
"12"
</simpara>
</listitem>
<listitem>
<simpara>
G - hour, 24-hour format without leading zeros; i.e. "0" to
"23"
</simpara>
</listitem>
<listitem>
<simpara>
h - hour, 12-hour format; i.e. "01" to "12"
</simpara>
</listitem>
<listitem>
<simpara>
H - hour, 24-hour format; i.e. "00" to "23"
</simpara>
</listitem>
<listitem>
<simpara>
i - minutes; i.e. "00" to "59"
</simpara>
</listitem>
<listitem>
<simpara>
I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
</simpara>
</listitem>
<listitem>
<simpara>
j - day of the month without leading zeros; i.e. "1" to "31"
</simpara>
</listitem>
<listitem>
<simpara>
l (lowercase 'L') - day of the week, textual, long;
i.e. "Friday"
</simpara>
</listitem>
<listitem>
<simpara>
L - boolean for whether it is a leap year; i.e. "0" or "1"
</simpara>
</listitem>
<listitem>
<simpara>
m - month; i.e. "01" to "12"
</simpara>
</listitem>
<listitem>
<simpara>
M - month, textual, 3 letters; i.e. "Jan"
</simpara>
</listitem>
<listitem>
<simpara>
n - month without leading zeros; i.e. "1" to "12"
</simpara>
</listitem>
<listitem>
<simpara>
s - seconds; i.e. "00" to "59"
</simpara>
</listitem>
<listitem>
<simpara>
S - English ordinal suffix, textual, 2 characters; i.e. "th",
"nd"
</simpara>
</listitem>
<listitem>
<simpara>
t - number of days in the given month; i.e. "28" to "31"
</simpara>
</listitem>
<listitem>
<simpara>
T - Timezone setting of this machine; i.e. "MDT"
</simpara>
</listitem>
<listitem>
<simpara>
U - seconds since the epoch
</simpara>
</listitem>
<listitem>
<simpara>
w - day of the week, numeric, i.e. "0" (Sunday) to "6"
(Saturday)
</simpara>
</listitem>
<listitem>
<simpara>
Y - year, 4 digits; i.e. "1999"
</simpara>
</listitem>
<listitem>
<simpara>
y - year, 2 digits; i.e. "99"
</simpara>
</listitem>
<listitem>
<simpara>
z - day of the year; i.e. "0" to "365"
</simpara>
</listitem>
<listitem>
<simpara>
Z - timezone offset in seconds (i.e. "-43200" to "43200")
</simpara>
</listitem>
</itemizedlist>
Unrecognized characters in the format string will be printed
as-is. The "Z" format will always return "0" when using
<function>gmdate</function>.
<example>
<title><function>Date</function> example</title>
<programlisting role="php">
print (date ("l dS of F Y h:i:s A"));
print ("July 1, 2000 is on a " . date ("l", mktime(0,0,0,7,1,2000)));
</programlisting>
</example>
</para>
<para>
It is possible to use <function>date</function> and
<function>mktime</function> together to find dates in the future
or the past.
<example>
<title>
<function>Date</function> and <function>mktime</function>
example
</title>
<programlisting>
$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y"));
$lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y"));
$nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1);
</programlisting>
</example>
</para>
<para>
To format dates in other languages, you should use the
<function>setlocale</function> and <function>strftime</function>
functions.
</para>
<para>
See also <function>gmdate</function> and
<function>mktime</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.getdate">
<refnamediv>
<refname>getdate</refname>
<refpurpose>Get date/time information</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>getdate</function></funcdef>
<paramdef>int <parameter>timestamp</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns an associative array containing the date information of
the <parameter>timestamp</parameter> as the following array
elements:
<itemizedlist>
<listitem>
<simpara>
"seconds" - seconds
</simpara>
</listitem>
<listitem>
<simpara>
"minutes" - minutes
</simpara>
</listitem>
<listitem>
<simpara>
"hours" - hours
</simpara>
</listitem>
<listitem>
<simpara>
"mday" - day of the month
</simpara>
</listitem>
<listitem>
<simpara>
"wday" - day of the week, numeric
</simpara>
</listitem>
<listitem>
<simpara>
"mon" - month, numeric
</simpara>
</listitem>
<listitem>
<simpara>
"year" - year, numeric
</simpara>
</listitem>
<listitem>
<simpara>
"yday" - day of the year, numeric; i.e. "299"
</simpara>
</listitem>
<listitem>
<simpara>
"weekday" - day of the week, textual, full; i.e. "Friday"
</simpara>
</listitem>
<listitem>
<simpara>
"month" - month, textual, full; i.e. "January"
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.gettimeofday">
<refnamediv>
<refname>gettimeofday</refname>
<refpurpose>Get current time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>gettimeofday</function></funcdef>
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
<para>
This is an interface to gettimeofday(2). It returns an
associative array containing the data returned from the system
call.
<itemizedlist>
<listitem>
<simpara>
"sec" - seconds
</simpara>
</listitem>
<listitem>
<simpara>
"usec" - microseconds
</simpara>
</listitem>
<listitem>
<simpara>
"minuteswest" - minutes west of Greenwich
</simpara>
</listitem>
<listitem>
<simpara>
"dsttime" - type of dst correction
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.gmdate">
<refnamediv>
<refname>gmdate</refname>
<refpurpose>Format a GMT/CUT date/time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>gmdate</function></funcdef>
<paramdef>string <parameter>format</parameter></paramdef>
<paramdef>int <parameter>timestamp</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Identical to the <function>date</function> function except that
the time returned is Greenwich Mean Time (GMT). For example, when
run in Finland (GMT +0200), the first line below prints "Jan 01
1998 00:00:00", while the second prints "Dec 31 1997 22:00:00".
<example>
<title><function>Gmdate</function> example</title>
<programlisting role="php">
echo date ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
</programlisting>
</example>
</para>
<para>
See also <function>date</function>, <function>mktime</function>,
and <function>gmmktime</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.gmmktime">
<refnamediv>
<refname>gmmktime</refname>
<refpurpose>Get UNIX timestamp for a GMT date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>gmmktime</function></funcdef>
<paramdef>int <parameter>hour</parameter></paramdef>
<paramdef>int <parameter>minute</parameter></paramdef>
<paramdef>int <parameter>second</parameter></paramdef>
<paramdef>int <parameter>month</parameter></paramdef>
<paramdef>int <parameter>day</parameter></paramdef>
<paramdef>int <parameter>year</parameter></paramdef>
<paramdef>int
<parameter><optional>is_dst</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Identical to <function>mktime</function> except the passed
parameters represents a GMT date.
</para>
</refsect1>
</refentry>
<refentry id="function.gmstrftime">
<refnamediv>
<refname>gmstrftime</refname>
<refpurpose>
Format a GMT/CUT time/date according to locale settings
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>gmstrftime</function></funcdef>
<paramdef>string <parameter>format</parameter></paramdef>
<paramdef>int <parameter>timestamp</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Behaves the same as <function>strftime</function> except that the
time returned is Greenwich Mean Time (GMT). For example, when run
in Eastern Standard Time (GMT -0500), the first line below prints
"Dec 31 1998 20:00:00", while the second prints "Jan 01 1999
01:00:00".
<example>
<title><function>Gmstrftime</function> example</title>
<programlisting role="php">
setlocale ('LC_TIME', 'en_US');
echo strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
echo gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
</programlisting>
</example>
</para>
<para>
See also <function>strftime</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.localtime">
<refnamediv>
<refname>localtime</refname>
<refpurpose>Get the local time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>localtime</function></funcdef>
<paramdef>int
<parameter>
<optional>timestamp</optional>
</parameter>
</paramdef>
<paramdef>bool
<parameter>
<optional>is_associative</optional>
</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
The <function>localtime</function> function returns an array
identical to that of the structure returned by the C function
call. The first argument to <function>localtime</function> is
the timestamp, if this is not given the current time is used.
The second argument to the <function>localtime</function> is the
<parameter>is_associative</parameter>, if this is set to 0 or not
supplied than the array is returned as a regular, numerically
indexed array. If the argument is set to 1 then
<function>localtime</function> is an associative array containing
all the different elements of the structure returned by the C
function call to localtime. The names of the different keys of
the associative array are as follows:
<itemizedlist>
<listitem>
<simpara>
"tm_sec" - seconds
</simpara>
</listitem>
<listitem>
<simpara>
"tm_min" - minutes
</simpara>
</listitem>
<listitem>
<simpara>
"tm_hour" - hour
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mday" - day of the month
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mon" - month of the year
</simpara>
</listitem>
<listitem>
<simpara>
"tm_year" - Year, not y2k compliant
</simpara>
</listitem>
<listitem>
<simpara>
"tm_wday" - Day of the week
</simpara>
</listitem>
<listitem>
<simpara>
"tm_yday" - Day of the year
</simpara>
</listitem>
<listitem>
<simpara>
"tm_isdst" - Is daylight savings time in effect
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<refentry id="function.microtime">
<refnamediv>
<refname>microtime</refname>
<refpurpose>
Return current UNIX timestamp with microseconds</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>microtime</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
<para>
Returns the string "msec sec" where sec is the current time
measured in the number of seconds since the Unix Epoch (0:00:00
January 1, 1970 GMT), and msec is the microseconds part. This
function is only available on operating systems that support the
gettimeofday() system call.
</para>
<para>
See also <function>time</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.mktime">
<refnamediv>
<refname>mktime</refname>
<refpurpose>Get UNIX timestamp for a date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>mktime</function></funcdef>
<paramdef>int <parameter>hour</parameter></paramdef>
<paramdef>int <parameter>minute</parameter></paramdef>
<paramdef>int <parameter>second</parameter></paramdef>
<paramdef>int <parameter>month</parameter></paramdef>
<paramdef>int <parameter>day</parameter></paramdef>
<paramdef>int <parameter>year</parameter></paramdef>
<paramdef>int
<parameter><optional>is_dst</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
<emphasis>Warning:</emphasis> Note the strange order of
arguments, which differs from the order of arguments in a regular
UNIX mktime() call and which does not lend itself well to leaving
out parameters from right to left (see below). It is a common
error to mix these values up in a script.
</para>
<para>
Returns the Unix timestamp corresponding to the arguments
given. This timestamp is a long integer containing the number of
seconds between the Unix Epoch (January 1 1970) and the time
specified.
</para>
<para>
Arguments may be left out in order from right to left; any
arguments thus omitted will be set to the current value according
to the local date and time.
</para>
<para>
<parameter>Is_dst</parameter> can be set to 1 if the time is
during daylight savings time, 0 if it is not, or -1 (the default)
if it is unknown whether the time is within daylight savings time
or not.
</para>
<note>
<para>
<parameter>Is_dst</parameter> was added in 3.0.10.
</para>
</note>
<para>
<function>Mktime</function> is useful for doing date arithmetic
and validation, as it will automatically calculate the correct
value for out-of-range input. For example, each of the following
lines produces the string "Jan-01-1998".
<example>
<title><function>Mktime</function> example</title>
<programlisting>
echo date ("M-d-Y", mktime (0,0,0,12,32,1997));
echo date ("M-d-Y", mktime (0,0,0,13,1,1997));
echo date ("M-d-Y", mktime (0,0,0,1,1,1998));
echo date ("M-d-Y", mktime (0,0,0,1,1,98));
</programlisting>
</example>
<parameter>Year</parameter> may be a two or four digit value,
with values between 0-69 mapping to 2000-2069 and 70-99 to
1970-1999 (on systems where time_t is a 32bit signed integer, as
most common today, the valid range for
<parameter>year</parameter> is somewhere between 1902 and 2037).
</para>
<para>
The last day of any given month can be expressed as the "0" day
of the next month, not the -1 day. Both of the following examples
will produce the string "The last day in Feb 2000 is: 29".
<example>
<title>Last day of next month</title>
<programlisting role="php">
$lastday = mktime (0,0,0,3,0,2000);
echo strftime ("Last day in Feb 2000 is: %d", $lastday);
$lastday = mktime (0,0,0,4,-31,2000);
echo strftime ("Last day in Feb 2000 is: %d", $lastday);
</programlisting>
</example>
</para>
<simpara>
Date with year, month and day equal to zero is considered illegal
(otherwise it what be regarded as 30.11.1999, which would be strange
behaviour).
</simpara>
<para>
See also <function>date</function> and <function>time</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.strftime">
<refnamediv>
<refname>strftime</refname>
<refpurpose>
Format a local time/date according to locale settings
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>strftime</function></funcdef>
<paramdef>string <parameter>format</parameter></paramdef>
<paramdef>int
<parameter>
<optional>timestamp</optional>
</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns a string formatted according to the given format string
using the given <parameter>timestamp</parameter> or the current
local time if no timestamp is given. Month and weekday names and
other language dependent strings respect the current locale set
with <function>setlocale</function>.
</para>
<para>
The following conversion specifiers are recognized in the format
string:
<itemizedlist>
<listitem>
<simpara>
%a - abbreviated weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%A - full weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%b - abbreviated month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%B - full month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%c - preferred date and time representation for the current
locale
</simpara>
</listitem>
<listitem>
<simpara>
%C - century number (the year divided by 100 and truncated to
an integer, range 00 to 99)
</simpara>
</listitem>
<listitem>
<simpara>
%d - day of the month as a decimal number (range 00 to 31)
</simpara>
</listitem>
<listitem>
<simpara>
%D - same as %m/%d/%y
</simpara>
</listitem>
<listitem>
<simpara>
%e - day of the month as a decimal number, a single digit is
preceded by a space (range ' 1' to '31')
</simpara>
</listitem>
<listitem>
<simpara>
%h - same as %b
</simpara>
</listitem>
<listitem>
<simpara>
%H - hour as a decimal number using a 24-hour clock (range 00
to 23)
</simpara>
</listitem>
<listitem>
<simpara>
%I - hour as a decimal number using a 12-hour clock (range 01
to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%j - day of the year as a decimal number (range 001 to 366)
</simpara>
</listitem>
<listitem>
<simpara>
%m - month as a decimal number (range 01 to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%M - minute as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%n - newline character
</simpara>
</listitem>
<listitem>
<simpara>
%p - either
am' or pm' according to the given time value, or
the corresponding strings for the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%r - time in a.m. and p.m. notation
</simpara>
</listitem>
<listitem>
<simpara>
%R - time in 24 hour notation
</simpara>
</listitem>
<listitem>
<simpara>
%S - second as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%t - tab character
</simpara>
</listitem>
<listitem>
<simpara>
%T - current time, equal to %H:%M:%S
</simpara>
</listitem>
<listitem>
<simpara>
%u - weekday as a decimal number [1,7], with 1 representing
Monday
</simpara>
</listitem>
<listitem>
<simpara>
%U - week number of the current year as a decimal number,
starting with the first Sunday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%V - The ISO 8601:1988 week number of the current year as a
decimal number, range 01 to 53, where week 1 is the first
week that has at least 4 days in the current year, and with
Monday as the first day of the week.
</simpara>
</listitem>
<listitem>
<simpara>
%W - week number of the current year as a decimal number,
starting with the first Monday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%w - day of the week as a decimal, Sunday being 0
</simpara>
</listitem>
<listitem>
<simpara>
%x - preferred date representation for the current locale
without the time
</simpara>
</listitem>
<listitem>
<simpara>
%X - preferred time representation for the current locale
without the date
</simpara>
</listitem>
<listitem>
<simpara>
%y - year as a decimal number without a century (range 00 to
99)
</simpara>
</listitem>
<listitem>
<simpara>
%Y - year as a decimal number including the century
</simpara>
</listitem>
<listitem>
<simpara>
%Z - time zone or name or abbreviation
</simpara>
</listitem>
<listitem>
<simpara>
%% - a literal `%' character
</simpara>
</listitem>
</itemizedlist>
<example>
<title><function>Strftime</function> example</title>
<programlisting role="php">
setlocale ("LC_TIME", "C");
print (strftime ("%A in Finnish is "));
setlocale ("LC_TIME", "fi_FI");
print (strftime ("%A, in French "));
setlocale ("LC_TIME", "fr_CA");
print (strftime ("%A and in German "));
setlocale ("LC_TIME", "de_DE");
print (strftime ("%A.\n"));
</programlisting>
</example>
This example works if you have the respective locales installed
in your system.
</para>
<para>
See also <function>setlocale</function> and
<function>mktime</function> and the <ulink
url="&spec.strftime;">
Open Group specification of
<function>strftime</function></ulink>.
</para>
</refsect1>
</refentry>
<refentry id="function.time">
<refnamediv>
<refname>time</refname>
<refpurpose>Return current UNIX timestamp</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>time</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
<para>
Returns the current time measured in the number of seconds since
the Unix Epoch (January 1 1970 00:00:00 GMT).
</para>
<para>
See also <function>date</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.strtotime">
<refnamediv>
<refname>strtotime</refname>
<refpurpose>
Parse about any english textual datetime description into a UNIX
timestamp
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>strtotime</function></funcdef>
<paramdef>string <parameter>time</parameter></paramdef>
<paramdef>int
<parameter><optional>now</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
The function expects to be given a string containing an english
date format and will try to parse that format into a UNIX
timestamp.
<example>
<title><function>Strtotime</function> examples</title>
<programlisting role="php">
echo strtotime ("now") . "\n";
echo strtotime ("10 September 2000") . "\n";
echo strtotime ("+1 day") . "\n";
echo strtotime ("+1 week") . "\n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds") . "\n";
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
Index: phpdoc/pt_BR/functions/dbase.xml
+++ phpdoc/pt_BR/functions/dbase.xml
<reference id="ref.dbase">
<title>dBase functions</title>
<titleabbrev>dBase</titleabbrev>
<partintro>
<simpara>
These functions allow you to access records stored in dBase-format
(dbf) databases.
</simpara>
<simpara>
There is no support for indexes or memo fields. There is no
support for locking, too. Two concurrent webserver processes
modifying the same dBase file will very likely ruin your database.
</simpara>
<simpara>
Unlike SQL databases, dBase "databases" cannot change the database
definition afterwards. Once the file is created, the database
definition is fixed. There are no indexes that speed searching or
otherwise organize your data. dBase files are simple sequential
files of fixed length records. Records are appended to the end of
the file and delete records are kept until you call
<function>dbase_pack()</function>.
</simpara>
<simpara>
We recommend that you do not use dBase files as your production
database. Choose any real SQL server instead; MySQL or Postgres
are common choices with PHP. dBase support is here to allow you to
import and export data to and from your web database, since the
file format is commonly understood with Windows spreadsheets and
organizers. Import and export of data is about all that dBase
support is good for.
</simpara>
</partintro>
<refentry id="function.dbase-create">
<refnamediv>
<refname>dbase_create</refname>
<refpurpose>Creates a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbase_create</function></funcdef>
<paramdef>string <parameter>filename</parameter></paramdef>
<paramdef>array <parameter>fields</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The <parameter>fields</parameter> parameter is an array of
arrays, each array describing the format of one field in the
database. Each field consists of a name, a character indicating
the field type, a length, and a precision.
</para>
<para>
The types of fields available are:
<variablelist>
<varlistentry>
<term>L</term>
<listitem>
<simpara>
Boolean. These do not have a length or precision.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>M</term>
<listitem>
<simpara>
Memo. (Note that these aren't supported by PHP.) These do
not have a length or precision.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>D</term>
<listitem>
<simpara>
Date (stored as YYYYMMDD). These do not have a length or
precision.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>N</term>
<listitem>
<simpara>
Number. These have both a length and a precision (the number
of digits after the decimal point).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>C</term>
<listitem>
<simpara>
String.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
If the database is successfully created, a dbase_identifier is
returned, otherwise false is returned.
<example>
<title>Creating a dBase database file</title>
<programlisting role="php">
// "database" name
$dbname = "/tmp/test.dbf";
// database "definition"
$def =
array(
array("date", "D"),
array("name", "C", 50),
array("age", "N", 3, 0),
array("email", "C", 128),
array("ismember", "L")
);
// creation
if (!dbase_create($dbname, $def))
print "<strong>Error!</strong>";
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-open">
<refnamediv>
<refname>dbase_open</refname>
<refpurpose>Opens a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbase_open</function></funcdef>
<paramdef>string <parameter>filename</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The flags correspond to those for the open() system call.
(Typically 0 means read-only, 1 means write-only, and 2 means
read and write.)
</para>
<para>
Returns a dbase_identifier for the opened database, or false if
the database couldn't be opened.
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-close">
<refnamediv>
<refname>dbase_close</refname>
<refpurpose>Close a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbase_close</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Closes the database associated with
<parameter>dbase_identifier</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-pack">
<refnamediv>
<refname>dbase_pack</refname>
<refpurpose>Packs a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbase_pack</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Packs the specified database (permanently deleting all records
marked for deletion using
<function>dbase_delete_record</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-add-record">
<refnamediv>
<refname>dbase_add_record</refname>
<refpurpose>Add a record to a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbase_add_record</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
<paramdef>array <parameter>record</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Adds the data in the <parameter>record </parameter>to the
database. If the number of items in the supplied record isn't
equal to the number of fields in the database, the operation will
fail and false will be returned.
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-replace-record">
<refnamediv>
<refname>dbase_replace_record</refname>
<refpurpose>Replace a record in a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbase_replace_record</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
<paramdef>array <parameter>record</parameter></paramdef>
<paramdef>int <parameter>dbase_record_number</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<simpara>
Replaces the data associated with the record
<parameter>record_number</parameter> with the data in the
<parameter>record</parameter> in the database. If the number of
items in the supplied record is not equal to the number of fields
in the database, the operation will fail and false will be
returned.
</simpara>
<simpara>
<parameter>dbase_record_number</parameter> is an integer which
spans from 1 to the number of records in the database (as
returned by <function>dbase_numrecords</function>).
</simpara>
</refsect1>
</refentry>
<refentry id="function.dbase-delete-record">
<refnamediv>
<refname>dbase_delete_record</refname>
<refpurpose>Deletes a record from a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbase_delete_record</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
<paramdef>int <parameter>record</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Marks <parameter>record</parameter> to be deleted from the
database. To actually remove the record from the database, you
must also call <function>dbase_pack</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-get-record">
<refnamediv>
<refname>dbase_get_record</refname>
<refpurpose>Gets a record from a dBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>array <function>dbase_get_record</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
<paramdef>int <parameter>record</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the data from <parameter>record</parameter> in an
array. The array is indexed starting at 0, and includes an
associative member named 'deleted' which is set to 1 if the
record has been marked for deletion (see
<function>dbase_delete_record</function>.
</para>
<para>
Each field is converted to the appropriate PHP type. (Dates are
left as strings.)
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-get-record-with-names">
<refnamediv>
<refname>dbase_get_record_with_names</refname>
<refpurpose>
Gets a record from a dBase database as an associative array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>array
<function>dbase_get_record_with_names</function>
</funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
<paramdef>int <parameter>record</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the data from <parameter>record</parameter> in an
associative array. The array also includes an associative member
named 'deleted' which is set to 1 if the record has been marked
for deletion (see <function>dbase_delete_record</function>.
</para>
<para>
Each field is converted to the appropriate PHP type. (Dates are
left as strings.)
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-numfields">
<refnamediv>
<refname>dbase_numfields</refname>
<refpurpose>
Find out how many fields are in a dBase database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbase_numfields</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the number of fields (columns) in the specified
database. Field numbers are between 0 and dbase_numfields($db)-1,
while record numbers are between 1 and dbase_numrecords($db).
<example>
<title>Using <function>dbase_numfields</function></title>
<programlisting role="php">
$rec = dbase_get_record($db, $recno);
$nf = dbase_numfields($db);
for ($i=0; $i < $nf; $i++) {
print $rec[$i]."<br>\n";
}
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.dbase-numrecords">
<refnamediv>
<refname>dbase_numrecords</refname>
<refpurpose>
Find out how many records are in a dBase database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbase_numrecords</function></funcdef>
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the number of records (rows) in the specified
database. Record numbers are between 1 and dbase_numrecords($db),
while field numbers are between 0 and dbase_numfields($db)-1.
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
Index: phpdoc/pt_BR/functions/dbm.xml
+++ phpdoc/pt_BR/functions/dbm.xml
<reference id="ref.dbm">
<title>DBM Functions</title>
<titleabbrev>DBM</titleabbrev>
<partintro>
<simpara>
These functions allow you to store records stored in a dbm-style
database. This type of database (supported by the Berkeley DB,
GDBM, and some system libraries, as well as a built-in flatfile
library) stores key/value pairs (as opposed to the full-blown
records supported by relational databases).
</simpara>
<para>
<example>
<title>DBM example</title>
<programlisting role="php">
$dbm = dbmopen ("lastseen", "w");
if (dbmexists ($dbm, $userid)) {
$last_seen = dbmfetch ($dbm, $userid);
} else {
dbminsert ($dbm, $userid, time());
}
do_stuff();
dbmreplace ($dbm, $userid, time());
dbmclose ($dbm);
</programlisting>
</example>
</para>
</partintro>
<refentry id="function.dbmopen">
<refnamediv>
<refname>dbmopen</refname>
<refpurpose>Opens a DBM database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbmopen</function></funcdef>
<paramdef>string <parameter>filename</parameter></paramdef>
<paramdef>string <parameter>flags</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The first argument is the full-path filename of the DBM file to
be opened and the second is the file open mode which is one of
"r", "n", "c" or "w" for read-only, new (implies
read-write, and
most likely will truncate an already-existing database of the
same name), create (implies read-write, and will not truncate an
already-existing database of the same name) and read-write
respectively.
</para>
<para>
Returns an identifer to be passed to the other DBM functions on
success, or false on failure.
</para>
<para>
If NDBM support is used, NDBM will actually create filename.dir
and filename.pag files. GDBM only uses one file, as does the
internal flat-file support, and Berkeley DB creates a
<filename>filename.db</filename> file. Note that PHP does its own
file locking in addition to any file locking that may be done by
the DBM library itself. PHP does not delete the
<filename>.lck</filename> files it creates. It uses these files
simply as fixed inodes on which to do the file locking. For more
information on DBM files, see your Unix man pages, or obtain
<ulink url="&url.gdbm;">GNU's GDBM</ulink>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmclose">
<refnamediv>
<refname>dbmclose</refname>
<refpurpose>Closes a dbm database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbmclose</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Unlocks and closes the specified database.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmexists">
<refnamediv>
<refname>dbmexists</refname>
<refpurpose>
Tells if a value exists for a key in a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbmexists</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns TRUE if there is a value associated with the
<parameter>key</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmfetch">
<refnamediv>
<refname>dbmfetch</refname>
<refpurpose>
Fetches a value for a key from a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>dbmfetch</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the value associated with <parameter>key</parameter>.
</para>
</refsect1>
</refentry>
<refentry id="function.dbminsert">
<refnamediv>
<refname>dbminsert</refname>
<refpurpose>
Inserts a value for a key in a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>dbminsert</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
<paramdef>string <parameter>value</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Adds the value to the database with the specified key.
</para>
<para>
Returns -1 if the database was opened read-only, 0 if the insert
was successful, and 1 if the specified key already exists. (To
replace the value, use <function>dbmreplace</function>.)
</para>
</refsect1>
</refentry>
<refentry id="function.dbmreplace">
<refnamediv>
<refname>dbmreplace</refname>
<refpurpose>
Replaces the value for a key in a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbmreplace</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
<paramdef>string <parameter>value</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Replaces the value for the specified key in the database.
</para>
<para>
This will also add the key to the database if it didn't already
exist.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmdelete">
<refnamediv>
<refname>dbmdelete</refname>
<refpurpose>
Deletes the value for a key from a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>dbmdelete</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Deletes the value for <parameter>key</parameter> in the database.
</para>
<para>
Returns false if the key didn't exist in the database.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmfirstkey">
<refnamediv>
<refname>dbmfirstkey</refname>
<refpurpose>
Retrieves the first key from a DBM database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>dbmfirstkey</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the first key in the database. Note that no particular order
is guaranteed since the database may be built using a hash-table,
which doesn't guarantee any ordering.
</para>
</refsect1>
</refentry>
<refentry id="function.dbmnextkey">
<refnamediv>
<refname>dbmnextkey</refname>
<refpurpose>
Retrieves the next key from a DBM database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>dbmnextkey</function></funcdef>
<paramdef>int <parameter>dbm_identifier</parameter></paramdef>
<paramdef>string <parameter>key</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns the next key after <parameter>key</parameter>. By calling
<function>dbmfirstkey</function> followed by successive
calls to <function>dbmnextkey</function> it is possible to
visit every key/value pair in the dbm database. For example:
<example>
<title>Visiting every key/value pair in a DBM database</title>
<programlisting role="php">
$key = dbmfirstkey ($dbm_id);
while ($key) {
echo "$key = " . dbmfetch ($dbm_id, $key) . "\n";
$key = dbmnextkey ($dbm_id, $key);
}
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.dblist">
<refnamediv>
<refname>dblist</refname>
<refpurpose>
Describes the DBM-compatible library being used
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>dblist</function></funcdef>
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->