Examples of defined() and strrchr() functions in PHP_PHP Tutorial

WBOY
Release: 2016-07-21 14:55:08
Original
1186 people have browsed it

defined() function

Definition and usage

defined() function checks whether a constant exists.

If the constant exists, return true, otherwise return false.

Example:

define("GREETING","Hello world!");
echo defined("GREETING");
?> ;

Output:

1

strrchr() function

Definition and Usage
The strrchr() function finds the last occurrence of a string in another string and returns all characters from that position to the end of the string.

If it fails, return false otherwise.

Syntax
strrchr(string,char)
Parameter Description
string Required. Specifies the string to be searched for.
char required. Specifies the characters to search for. If the argument is a number, searches for characters matching the numeric ASCII value.

Example 1
echo strrchr("Hello world!","world");
?>
Output:

world !
Example 2
echo strrchr("Hello world!",111);
?>
Output:

orld!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364458.htmlTechArticledefined() Function definition and usage defined() function checks whether a constant exists. Returns true if the constant exists, false otherwise. Example: ?php define(GREETING,Hello world!);...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!