Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Possible bug with Uri::segment()
ilNotturno
August 2013
Hi all,
I've tried to retrieve segment information. Here is my print:
Uri::segments();
Array
(
[0] => blog
[1] => 2013
[2] => 4
[3] => snippet-how-to-remove-svn-information-from-a-folder
)
Uri::segment(0);
EMPTY STRING
Uri::segment(1);
'blog'
Uri::segment(1);
'2013'
Is it my fault or Uri::segment(0); should be "blog" (and go on)?
Harro
August 2013
Accepted Answer
According to the docblock in the code, the index is base-1, so there is no such thing as segment(0). Which is logical, you're asking for the first segment.
segments() gives you the raw segment dump in an array, and arrays always start at 0.
Syntaxlb
August 2013
Hi,
It's normal "Segment index is 1 based, not 0 based"
ilNotturno
August 2013
Sorry, I lost that line ... Thanks guys :-]
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
August 2013
ilNotturno
August 2013
Syntaxlb
August 2013