Site icon Hip-Hop Website Design and Development

How to sort (orderby) a query done by a template function before the ‘foreach’ loop?

How can I sort an array of elements being hold on a query done by a template function, just before the output starts on a foreach loop?
I wanted to order my elements by the Post Title. Here is my code:

<?php
$show_subproperties = apushome_get_config('show_property_sub', true);
if (!$show_subproperties) {
    return;
}
$post = get_post();
$author_id = $post->post_author;
$subproperties = Realia_Post_Type_Property::get_properties($author_id, "publish", get_the_ID()); ?>

<?php if (is_array($subproperties) && !empty($subproperties)) : ?>
    <div class="property-subproperties">
        <h3><?php echo esc_html__('Módulos Individuais', 'apushome'); ?></h3>
        <div class="clearfix">
            <?php foreach ($subproperties as $subproperty) : ?>
            <div class="col-md-4 col-lg-3 col-sm-6 col-xs-12 modulos-i">
                <?php echo Realia_Template_Loader::load('properties/box', array('property' => $subproperty)); ?>
            </div>
            <?php endforeach; ?>
        </div><!-- /.row -->
    </div><!-- /.subproperties -->
<?php endif ?>