Welcome, Guest: Join CodeXpress Log In!

Stats: 12 Members, 112 topics and 9 posts Date:  Thursday 24 June 2021 at 09:40 AM

This is a product of CodeXpress Buy License for your website

PHP 8x use of str starts with functions

CodeXpress / Science/Technology / Programing / PHP 8x use of str starts with functions

24 people viewed

Php 8x Use Of Str Starts With Functions
(Go Down) (» Reply topic)
PHP 8x use of str starts with functions by Marshallunduemi(): Sat 17, April, 2021
PHP 8 or newer:
Use the str_starts_with function:

str_starts_with('http://www.google.com', 'http')
PHP 7 or older:
Use the substr function to return a part of a string.

substr( $string_n, 0, 4 ) === "http"
If you're trying to make sure it's not another protocol. I'd use http:// instead, since https would also match, and other things such as http-protocol.com.

substr( $string_n, 0, 7 ) === "http://"
And in general:

substr($string, 0, strlen($query)) === $query

Welcome to CodeXpress Forum Script - Download NL script Free
(» Go Up)

You must Sign in or Sign Up to post content

For you to post content on this website you have to log in or register, it only take few minute to create account

Go Up

Recommended for you

Php 8x Use Of Str Starts With Functions

Currently: 1 guest(s) reading this article

Developed by Codexpress Programming Labs
Post content
Powered by Marshall