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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:59:03+00:00 2026-06-03T16:59:03+00:00

I have an array containing friends list of a user on Facebook. I have

  • 0

I have an array containing friends list of a user on Facebook.

I have to display that list and provide a text field on the top of the list to enter first letter of any of his/her friends name. When the user enters a letter in the text field, the program should display only the names that start with the entered letter, all other names should vanish.

In addition the names should be sorted alphabetically.

How do I perform this task?

  • 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-03T16:59:05+00:00Added an answer on June 3, 2026 at 4:59 pm

    First I have to ask are you using javascript or anything to filter or is it just server side code using php?

    Aside from that here’s the steps to how I would do it just on the php side.

    1) Sort the entire list of all the user’s friends so the full array is in order. Take a look at this http://www.php.net/manual/en/function.sort.php.

    2) When the user inputs their single letter, you simply just have to:

    • Create a new array to store the results of the user’s search
    • Loop through your large array of all the friends and insert the matches into the smaller array
    • Display the small array as it will already be sorted from having the master list already sorted.

      for ($i = 1; $i <= $masterFriendsList.length; $i++) {
          if (substr($masterFriendsList[i],0,1)==$yourMatchValue){
              $filteredArray[]=$masterFriendsList[i];
          }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array containing a list of file paths that I want to
I have an array containing a list of files. I want to sort it
I have an array of variables all containing text. I want to select only
I have an array containing an unknown number of items that I would like
I have a 2d array containing first name, last name, and a third irrelevant
I have an array containing names of items. I want to give the user
I have an array that has an array containing more data stored into one
Here is my issue. I have an array containing the name of cities that
I have an array containing strings of this format: [0] => title|url|score|user|date [1] =>
Let's say I have an array containing Blocks, and I need to assert that

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.