Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions reference/strings/functions/str-decrement.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.str-decrement">
<refnamediv>
<refname>str_decrement</refname>
<refpurpose>Decrement an alphanumeric string</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>str_decrement</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
Returns the decremented alphanumeric <acronym>ASCII</acronym>
<parameter>string</parameter>.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the decremented alphanumeric <acronym>ASCII</acronym> string.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
A <classname>ValueError</classname> is thrown if
<parameter>string</parameter> is empty.
</para>
<para>
A <classname>ValueError</classname> is thrown if
<parameter>string</parameter> is not an alphanumeric
<acronym>ASCII</acronym> string.
</para>
<para>
A <classname>ValueError</classname> is thrown if
<parameter>string</parameter> cannot be decremented.
For example, <literal>"A"</literal> or <literal>"0"</literal>.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Basic <function>str_decrement</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'ABC';
var_dump(str_decrement($str));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(3) "ABB"
]]>
</screen>
</example>
</para>
<para>
<example>
<title><function>str_decrement</function> example with a carry</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'ZA';
var_dump(str_decrement($str));

$str = 'AA';
var_dump(str_decrement($str));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(2) "YZ"
string(1) "Z"
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>str_increment</function></member>
</simplelist>
</para>
</refsect1>

</refentry>
<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
131 changes: 131 additions & 0 deletions reference/strings/functions/str-increment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.str-increment">
<refnamediv>
<refname>str_increment</refname>
<refpurpose>Increment an alphanumeric string</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>str_increment</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
Returns the incremented alphanumeric <acronym>ASCII</acronym>
<parameter>string</parameter>.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the incremented alphanumeric <acronym>ASCII</acronym> string.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
A <classname>ValueError</classname> is thrown if
<parameter>string</parameter> is empty.
</para>
<para>
A <classname>ValueError</classname> is thrown if
<parameter>string</parameter> is not an alphanumeric
<acronym>ASCII</acronym> string.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Basic <function>str_increment</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'ABC';
var_dump(str_increment($str));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(3) "ABD"
]]>
</screen>
</example>
</para>
<para>
<example>
<title><function>str_increment</function> example with a carry</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'DZ';
var_dump(str_increment($str));

$str = 'ZZ';
var_dump(str_increment($str));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(2) "EA"
string(3) "AAA"
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>str_decrement</function></member>
</simplelist>
</para>
</refsect1>

</refentry>
<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
2 changes: 2 additions & 0 deletions reference/strings/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@
<function name="sprintf" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="sscanf" from="PHP 4 &gt;= 4.0.1, PHP 5, PHP 7, PHP 8"/>
<function name="str_contains" from="PHP 8"/>
<function name="str_decrement" from="PHP 8 &gt;= 8.3.0"/>
<function name="str_ends_with" from="PHP 8"/>
<function name="str_getcsv" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8"/>
<function name="str_ireplace" from="PHP 5, PHP 7, PHP 8"/>
<function name="str_increment" from="PHP 8 &gt;= 8.3.0"/>
<function name="str_pad" from="PHP 4 &gt;= 4.0.1, PHP 5, PHP 7, PHP 8"/>
<function name="str_repeat" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="str_replace" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
Expand Down