<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision$ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.openssl-random-pseudo-bytes"> <refnamediv> <refname>openssl_random_pseudo_bytes</refname> <refpurpose>Generate a pseudo-random string</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>openssl_random_pseudo_bytes</methodname> <methodparam><type>string</type><parameter>length</parameter></methodparam> <methodparam><type>string</type><parameter>strong</parameter></methodparam> </methodsynopsis> <para> <function>openssl_random_pseudo_bytes</function> returns a &string; with <parameter>length</parameter> caracters. It also indicates if it has used a strong algorithm to produce those pseudo-random bytes in the second argument. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>length</parameter></term> <listitem> <para> The length of the desired string. Must be a positive integer. PHP will try to cast this parameter to a non-null integer to use it. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>strong</parameter></term> <listitem> <para> If a strong algorithm was used, or not, as a boolean. This parameter will be &null; if an error occurrs. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the generated &string; in case of success, &return.falseforfailure;. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>openssl_random_pseudo_bytes</function> example</title> <programlisting role="php"> <![CDATA[ <?php for ($i = -1; $i < 5; $i++) { var_dump(bin2hex(openssl_random_pseudo_bytes($i, $strong))); var_dump($strong); } ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ string(0) "" NULL string(0) "" NULL string(2) "f6" bool(true) string(4) "8999" bool(true) string(6) "c202c9" bool(true) string(8) "45261b8f" bool(true) ]]> </screen> </example> </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 -->