Please advice, how to writing code in php , only echo letter that between [ ] , like

we are going to [uk]

echo uk

Member Avatar for diafol

You can use string replace functions - normal ones or regex functions (preg_*).

Look at str_replace(), substr(), preg_match(), preg_replace() over at the php.net site.

Easiest way, I suppose would be:

$text = str_replace(array('[',']'),'',$text);

Or

$text = substr($text,1,strlen($text)-2);

Depends if you have more than [...] in the string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.