Home  >  Article  >  Backend Development  >  Summary of various judgments on strings in php

Summary of various judgments on strings in php

不言
不言Original
2018-08-04 15:17:411893browse

The content of this article is to share with you a summary of various judgments on strings in PHP. The content is very detailed and has certain reference value. I hope it can help friends in need.

1. Determine whether the string is empty

$namedRange !== NULL$pSheet === NULL

2. Determine whether the file exists and whether it is readable

(file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)

3. Compare the two "PHP normalized" version number strings

version_compare ( string $version1 , string $version2 [, string $operator ] )

Return mixed string $version1 – version 1 required string $version2 – version 2 required string $operator – understood as Optional operators

are 7218c44422b12f1e5727956f42ed263a, gt, >=, ge, ==, =, eq, !=, a8093152e673feb7aba1828c43532094 and ne.

If the third parameter is specified, a boolean is returned. If the third parameter is not specified, the following three situations are returned:

The first version is lower than the second version. Return -1 when the first version is equal to the second version, return 0 when the first version is less than the second version, return 1**Example**version_compare(PHP_VERSION, '5.3.0') >= 0

Recommended related articles:

Parsing of AES encrypted files in PHP (with code)

Summary of methods for extracting numbers from strings in PHP (code )

The above is the detailed content of Summary of various judgments on strings in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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