Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Removing specific character from URL par.

Name: Anonymous 2014-03-30 22:06

Hello, I need to take a URL like so "www.example.com/abc.php?parameter=..variable.1.lol"; and insert ".variable.1.lol" into the abc.php page. However, I want to remove the first "." but not the later dots when inserting.

This would be easy if there was always a first dot (substr($item,1) if $item1 is $_GET['pareter'].

HOWEVER, sometimes there won't be any dot and I'd end up removin the first letter accidentally. So how can I make PHP only subtract the first character in the variable when that character is a dot????????

Thank you very much,

Name: Anonymous 2014-03-30 22:18

In case anybody is still wondering, the solution is:

$item2 = (substr($item, 0, 1) === '.' ? substr($item, 1) : $item);.

Thread may now be closed.

Name: Anonymous 2014-03-30 22:23

REMOVE KEBAB

Don't change these.
Name: Email:
Entire Thread Thread List