Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:13:48+00:00 2026-06-16T19:13:48+00:00

Update : I was looking at docs for strrpos thinking it was the docs

  • 0

Update: I was looking at docs for strrpos thinking it was the docs for strpos. Sorry for the dumb mistake.

According to the docs, it says that when you provide a negative value as an offset argument, the function will start that many characters from the end of the string, searching backwards. It even shows this in Example #2. Why then can I not get this code to work properly?

$val = strpos('/imports/products/nin_avatar.png', '/', -2);

I am trying to get the index of the last forward slash in the string, yet it keeps returning false.. I’ve tried a couple different negative offsets, and none seem to work. Am I doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:13:50+00:00Added an answer on June 16, 2026 at 7:13 pm

    It seems it works as the OP intended now in a new version of PHP.


    Historical answer

    The PHP manual for strpos() says…

    Unlike strrpos() and strripos(), the offset cannot be negative.

    Source.

    This would be more obvious if you developed with warnings enabled. In your development instance, use something like error_reporting(E_ALL).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to find information on how to update my XCode program that has
I'm looking to update a MySQL database with items from an RSS Feed. When
I am looking to update rows where the date column is NULL by averaging
Where can I download .NetFramework 4 SDK? Update I am looking specifically for the
Looking at all the possibilites of creation / update columns in NHibernate I mostly
I'm looking forward to have an update on the following topic as it does
Looking for a good tutorial on how to update a mysql database using a
I am looking for the most efficient way to update a number of rows
Update 3 : Never mind. I kinda got what I was looking for. The
Im looking to learn more about your testing flows with Django. Background information http://docs.djangoproject.com/en/dev/topics/testing/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.