Logo

Programming-Idioms

History of Idiom 96 > diff from v18 to v19

Edit summary for version 19 by :
New PHP implementation by user [Feifan]

Version 18

2016-02-18, 16:58:02

Version 19

2016-02-23, 13:32:53

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Code
$s = "http://asdf.com";
$b = (preg_match('#^http#', $s) === 1) ? true: false;