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

  • Home
  • SEARCH
  • 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 6378795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:03:15+00:00 2026-05-25T02:03:15+00:00

$string = 01234567890*****12345678901234567890*; echo strrpos($string,’*****’); why does this return 36 and not 15? (

  • 0
$string = "01234567890*****12345678901234567890*";  
echo strrpos($string,'*****');

why does this return 36 and not 15? (click here to test)

from php.net
strrpos — Find the position of the last occurrence of a substring
in a string

What am I missing out on???
Thank you!

SOLUTION:
using the answers bellow, I provided a PHP4 alternative

$haystack = "01234567890*****12345678901234567890*";  
$needle              = '*****';

$position = strlen($haystack) - strlen($needle) - strpos(strrev($haystack),strrev($needle));
echo $position; // 11
  • 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-05-25T02:03:16+00:00Added an answer on May 25, 2026 at 2:03 am

    Probably you’re using PHP 4:

    from php.net

    needle:
    If needle is not a string, it is converted to an integer and applied as the ordinal value of a character. The needle can only be a single character in PHP 4.

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

Sidebar

Related Questions

I've got an issue making scanner working for this particular string. here comes the
Here's a BroadcastReceiver from my project, which I'm looking to unit test. When the
string strLine;//not constant int index = 0; while(index < strLine.length()){//strLine is not modified}; how
String[] a = c.toArray(new String[0]); First: Do I need type cast here? (I think
I found this regarding how the C preprocessor should handle string literal concatenation (phase
I wrote this code in C: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h>
Consider the following Pattern :- aba And the foll. source string :- abababbbaba 01234567890
I'm using the following code to generate a random string: <?php function random_string( )
We try to convert from string to Byte[] using the following Java code: String
I get <identifier> expected error on this line.... private static String getReducedISBN(char 'x') {

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.