Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync random_int and strrchr #803

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions reference/random/functions/random-int.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 553952f03f444f2c130c35de0d1ea8dc04fa0cf9 Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 0ec8e36e0f649354b20c714080a903d32df4dbfb Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: Luffy -->
<refentry xml:id="function.random-int" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>random_int</refname>
Expand Down Expand Up @@ -115,7 +116,7 @@ int(-898)
<refsect1 role="seealso"><!-- {{{ -->
&reftitle.seealso;
<simplelist>
<member><function>Random\Randomizer::getInt</function></member>
<member><methodname>Random\Randomizer::getInt</methodname></member>
<member><function>random_bytes</function></member>
</simplelist>
</refsect1><!-- }}} -->
Expand Down
21 changes: 13 additions & 8 deletions reference/strings/functions/strrchr.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 31d54a1c340cec9b15047f9f398d10e15f59f934 Maintainer: daijie Status: ready -->
<!-- EN-Revision: a2ba966ef221784188fc900f17080df284e4a56c Maintainer: daijie Status: ready -->
sy-records marked this conversation as resolved.
Show resolved Hide resolved
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.strrchr" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -106,16 +106,21 @@
<programlisting role="php">
<![CDATA[
<?php
// 获取 $PATH 中不含磁盘符号的目录
$dir = substr(strrchr($PATH, ":"), 1);

// 获取最后一行内容
$text = "Line 1\nLine 2\nLine 3";
$last = substr(strrchr($text, 10), 1 );
$ext = strrchr('somefile.txt', '.');
echo "file extension: $ext \n";
$ext = $ext ? strtolower(substr($ext, 1)) : '';
echo "file extension: $ext";
?>
]]>
</programlisting>
</example>
&example.outputs.similar;
<screen>
<![CDATA[
file extension: .txt
file extension: txt
]]>
</screen>
</example>
</para>
</refsect1>

Expand Down