|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How do I check if http:// is at the beginning of $web_site and if it
isn't add it? Ron |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Fri, Aug 29, 2008 at 11:25 AM, Ron Piggott <ron.php@actsministries.org>wrote:
> How do I check if http:// is at the beginning of $web_site and if it > isn't add it? Ron > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > You could use substr() (www.php.net/substr) if ( substr( $web_site, 0, 7 ) != "http://" ) { $web_site = "http://" . $web_site; } -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life." |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Fri, Aug 29, 2008 at 11:33 AM, Dan Joseph <dmjoseph@gmail.com> wrote:
> You could use substr() (www.php.net/substr) > > if ( substr( $web_site, 0, 7 ) != "http://" ) > { > $web_site = "http://" . $web_site; > } > > -- > -Dan Joseph Or parse_url() |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> You could use substr() (www.php.net/substr)
strncmp is better and faster for this purpose. Best Regards, Felhő |
|
![]() |
| Outils de la discussion | |
|
|