strrev() – Reversing a String in PHP

This article explains the PHP strrev() function, detailing its syntax, parameter description, return value, and provides a clear example that demonstrates how to reverse a string such as "Hello world!" using this built‑in function.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
strrev() – Reversing a String in PHP

The strrev() function in PHP returns the reversed version of a given string.

Signature: string strrev(string $string) Parameter: $string – the original string to be reversed.

Return value: The function returns a new string that is the reverse of the input.

Example:

<?php
echo strrev("Hello world!");
// 输出 "!dlrow olleH"
?>

The above code outputs !dlrow olleH, demonstrating the function’s effect.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendStringTutorialfunction
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.