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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:42:07+00:00 2026-06-16T23:42:07+00:00

Playing around with a custom built CMS and I have an issue where I

  • 0

Playing around with a custom built CMS and I have an issue where I have several Postal Codes saved to the database relating to a specific store.

I am loading them within an Object array as such

Array ( 
  [0] => PostalCodes Object ( 
    [ID] => 0fea73e60ef4e5809e1ec4900a1f6075
    [StoreID] => 7f0563d8e451d2342ca4b6a3b5402665
    [PostalCode] => L2E
  )
  [1] => PostalCodes Object (
    [ID] => 11e82b7f0e69dd3982352cf6b983ca9f
    [StoreID] => 7f0563d8e451d2342ca4b6a3b5402665
    [PostalCode] => L0R1S0
  )
) 

My question is what would be the most efficient way to sort them mixed Alphabetically & Numerically before outputting them in a for each loop?

  • 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-16T23:42:08+00:00Added an answer on June 16, 2026 at 11:42 pm

    The function is calledusort(), and you can simply use strcmp() on the postal codes.

    function myCompare($a, $b) {
        return strcmp($a->PostalCode, $b->PostalCode)
    }
    
    usort($myarray, 'myCompare');
    

    Also, in your future postings be sure to post your data with more easily readable formatting. A lot of people will not bother to take the time to read or reformat what you originally posted.

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

Sidebar

Related Questions

I'm playing around with a custom theme for Wordpress and I have this code
I've been playing around with custom attributes this evening to see if I could
Just playing around with Wordpress 3.0 for the first time. I've installed the Custom
I been playing around with some custom html helpers and I now I am
I'm currently playing around with a CMS idea I've got. It's based on a
I'm playing around with drawing in iOS apps. I have a class that is
I'm having a great time playing around with knockout js and have just started
i'm playing around with the navigator class and custom views within air for android
I am playing around with the KeyboardFocusManager and my own custom KeyEventDispatcher that redispathes
I'm playing around with 2D drawing within a custom view. So far I've got

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.