Code Comments
Programming Forum and web based access to our favorite programming groups.How I can convert variable $one="index.html" into variable $two="indexhtml" or $two="index" something without point or only te first word . The varabile is a string.
Post Follow-up to this messageThere are s lot of ways to do so. Here are a few:
$one = "index.html";
$two = explode(".","index.html");
echo ($two[0]); // "index"
echo ($two[1]); // "html"
--------------------------------------- OR
$one = "index.html";
$two = str_replace(".","",$one);
echo $two; // "indexhtml"
--------------------------------------- OR
$one = "index.html";
$pos = strpos($one,".");
$two = substr($one,0,$pos);
$three = substr($one,$pos+1);
and I'm sure there are a lot of other ways :)
Good Luck!
Harrie
Grzegorz R wrote:
> How I can convert variable $one="index.html" into variable
> $two="indexhtml" or $two="index" something without point or only te fir
st
> word . The varabile is a string.
>
>
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.