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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:22:19+00:00 2026-06-02T22:22:19+00:00

<?php $rate=array ( M100B1000 => 40.00, M1000B20000 => 80.00, M500B10000 => 50.00, MUnlimitedBUnlimited =>

  • 0
<?php
$rate=array ( "M100B1000" => "40.00", "M1000B20000" => "80.00", "M500B10000" => "50.00", "MUnlimitedBUnlimited" => "240.00", "M5000BUnlimited" => "120.00 ") ;
ksort($rate);
print_r($rate);
?>

It gives sorting rate array..

M1000B20000
M100B1000
M5000BUnlimited
M500B10000
MUnlimitedBUnlimited

I Need this sorting..

M100B1000
M500B10000
M1000B20000
M5000BUnlimited
MUnlimitedBUnlimited

Give some ideas…

  • 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-02T22:22:20+00:00Added an answer on June 2, 2026 at 10:22 pm

    it looks like you want to sort it based on the size of the string if yes take a look at this example

    more explanation here http://php.net/manual/en/function.sort.php

     function shortestFirst(key($str1), key($str2)) {
    
            return strlen(key($str1)) - strlen(key($str2));
    
         }
        $rate=array ( "M100B1000" => "40.00", "M1000B20000" => "80.00", "M500B10000" => "50.00", "MUnlimitedBUnlimited" => "240.00", "M5000BUnlimited" => "120.00 "); 
    
    
        uasort($data, 'shortestFirst');
            print_r($data);
            echo '</pre>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a below array in PHP $arrOrders['remains'] = 'ASC'; $arrOrders['rate'] = 'DESC'; How
php -v gives this PHP Warning: PHP Startup: memcache: Unable to initialize module Module
I'm using a jQuery ajax json call to retrieve a 3 dimensional PHP array
Possible Duplicate: How to implement exchange rate in PHP? Im currently making a REST
I'm trying to program a PHP-script, where users can rate the goodness of the
$result = mysql_query(SELECT avg(r.rate) FROM rate r where ImgName='1'); this php is not working.
All, I have the following code: $.post(save.php, {rate: value, vendor: vendor_id}, function(results) { alert(results);
I'm building a small experiment in php/javascript, where people have to rate the familiarity
Hi i have the following serialized PHP array stored in my mySQL database: a:2:{s:6:access;a:116:{i:0;s:17:catalog
When I do the following $arr['exchange'] = array('to' => $to, 'rate' => $result[0]); the

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.