Page 1 of 1

substr() question

Posted: Thu Jul 11, 2002 5:56 pm
by Sevengraff
How can remove the last 4 characters from the value of a variable???
example:
i have a variable with the value of "index.inc"
I want to remove the .inc from the end, so that the value is "index"
Im told substr() can do this, but when i use it like this:

Code: Select all

$file = substr("$viewFile", 0, -4);
($file is just $viewFile without the .inc) it doesn't work.
Can anyone help?

Posted: Thu Jul 11, 2002 6:30 pm
by Sevengraff
never mind, i got it to work. Thanks anyway!