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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:10:53+00:00 2026-06-14T17:10:53+00:00

I have these values in a database: |12||3||28||7||54| My code (see below) return these

  • 0

I have these values in a database:

|12||3||28||7||54|

My code (see below) return these strings:

Username_12

Username_3

Username_28

How to sort in reverse?

How to get these values:

Username_54

Username_7

Username_28

function display_user_friends($profileuserid,$friends,$base_url,$rewrite,$template_directory,$default_avatar) {
  if(!empty($friends)){
        $x = 0;
        $friends = explode("|",$friends);
        foreach($friends as $friend) {
          if($friend>0 && (strpos($already_displayed,"|$friend|")===false) && ($x < 3) {
              $sql_query = "SELECT username,userid FROM users WHERE userid = $friend && userstatus = 1 LIMIT 1";
              $result = @mysql_query($sql_query);
              if(mysql_num_rows($result))
              {
              while($row = mysql_fetch_array($result))
              {
                $x++;

                $already_displayed.="|$friend|";

                $username = stripslashes($row['username']);
                $userid = $row['userid'];
                $content.="<b>$username</b><br>";
              }                  
            }
          }
        }
  }
  else
    $content = "No friends found.";


  return $content;
}
  • 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-14T17:10:54+00:00Added an answer on June 14, 2026 at 5:10 pm

    I think you’re looking for array_reverse().

    array array_reverse ( array $array [, bool $preserve_keys = false ] )
    

    Takes an input array and returns a new array with the order of the
    elements reversed.

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

Sidebar

Related Questions

I have a Ci script outputting database values. On these values '#commentLink' and '#commentBox'
I have a php form which saves these values to the database: id rand
I have a field in my database that contain comma separated values these values
I have these code in my views.py: array = [] p = Person.objects.filter(client=1,status='Complete').values('name', 'age',
I have a database table full of time points and experimental values at those
I have these in a jsp file. But these values are not updated in
I have these tables and values: Table1 ------------------------ ID | Value ------------------------ 2 |
I have a list with these values: ['1', '10', '100.3', '1000.4', '1000.42', '150', '200',
I have a textbox that accepts only these values: . , - $ m
I have a string like val1_val2,val3_val4 and I need to split these values to

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.