Files
doc-en/reference/strings/functions/str-increment.xml
2023-10-06 12:59:18 +01:00

132 lines
2.7 KiB
XML

<?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
-->