CodeIgniter Forums
can uri segment accept last segment value as 0, why? why not? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: can uri segment accept last segment value as 0, why? why not? (/showthread.php?tid=49503)



can uri segment accept last segment value as 0, why? why not? - El Forum - 02-22-2012

[eluser]Unknown[/eluser]
Consider url like this

http://ellislab.com/forums/newtopic/0

here
i want last segment
1 - forums
2 - newtopic
3 - 0

So if i used,
$this->url->segment(3), give me some result? or Id something

thank you for ur help.


can uri segment accept last segment value as 0, why? why not? - El Forum - 02-22-2012

[eluser]InsiteFX[/eluser]
Did you try echoing it out to see what you get?

Most likely PHP will think it is FALSE 0 if it doe's then you could try the below.
Code:
$value = (int) $this->url->segment(3);