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 8833675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:50:13+00:00 2026-06-14T08:50:13+00:00

I had an interview yesterday for a Senior Software Developer role. I can’t remember

  • 0

I had an interview yesterday for a Senior Software Developer role. I can’t remember the question very well, but I try to write it as much as I remember.

Question:

Write a function that takes a string as the input and return true if traversed, false if not.

Requirements: (as much as I remember)

  • There is only one input type: string.
  • The string parameter must be passed by reference.
  • No new variables should be declared within the function — he meant that if the parameter is called $str, then manipulation should only be done on that. He didn’t like me using a second variable to set $reverseStr etc.
  • No looping every character in the string, he specifically said not to loop thru every character in the string.
  • No built-in PHP functions could be used; I think he was fine with strlen().

My Answer: (nope he didn’t like it)

$str = 'this is testing';
$length = strlen($str);
$reverseStr = '';
for($i=$length-1; $i>=0; $i--) {
 $reverseStr .= $str[$i];
}

While this does the job somewhat, he didn’t like me to go through every character to get $reverseStr. I am guessing I needed to think about a recursive solution get the last character of the string and index etc., but I am thinking about these as I am writing this, too late!

What you guys thinking?

  • 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-14T08:50:15+00:00Added an answer on June 14, 2026 at 8:50 am

    the question isn’t clear at all.. but if you want to check if the string is a palindrome:

    function is_palindrome ($str){
        if(strlen($str)==0){return true;}
        if($str[0]==$str[strlen($str)-1]){
            return true and is_palindrome(substr($str, 1, strlen($str)-2));
        }else{
            return false;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yesterday i had a question in an interview which i thought i could find
Had this question in the interview yesterday. Which is better to use? Infix(with parenthesis)
I had an interview today and every thing was going very good, but then
We once had an interview with a very experienced C++ developer who couldn't answer
Yesterday i had this interview question, which I couldn't fully answer: Given a function
I thought I had reasonable answers for this question at a recent interview, but
I had an interview today which involved this very question and in order to
I had telephone interview question yesterday. The interviewer asked me if I had faced
In an programming interview I had yesterday, one of the programs I had to
I had an interview days ago and was thrown a question like this. Q:

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.