Category : arrays

I have an array that I have sorted by year within which I have arrays with a lastname key. I can’t sort this subarray by lastname. I managed to classify by year. But the arrays inside are not sorted by lastname. Can I have some help please ? [1946] => Array ( [0] => Array ..

Read more

I have 2 arrays, that look like this: $alertTypes = [‘outbid’, ‘subAllVendorComments’]; $channels = [‘outbiduseSms’, ‘outbiduseBrowser’, ‘subAllVendorCommentsuseEmail’, ‘subAllVendorCommentsuseWhatsApp’]; My aim is to combine them into one array that is structured like this: Array ( [outbid] => Array ( [0] => useSms, [1] => useBrowser ) [subAllVendorComments] => Array ( [0] => useEmail, [1] => useWhatsApp ..

Read more

I like to group a multidimensional array and sum one element like so (the color is always the same within the same type): $arr = [ [‘type’ => ‘x’, ‘color’ => ‘red’, ‘amount => 100’], [‘type’ => ‘x’, ‘color’ => ‘red’, ‘amount => 100’], [‘type’ => ‘y’, ‘color’ => ‘blue’, ‘amount => 50’] ]; Result: ..

Read more

I need to sort the locations in alphabetical order in this search form: http://v2trgmanagementcompanycom.temp312.kinsta.cloud/portfolio/ All of the options are coming from WordPress portfolio. This should be the code for that form: <?php $array = OSF_Custom_Post_Type_Portfolio::getInstance()->get_all_meta_field_value(); ?> <div class="search-project"> <form action="<?php echo get_post_type_archive_link(‘osf_portfolio’); ?>" method="get"> <div class="d-flex justify-content-center project-group"> <div class="project-inner"> <select name="osf_portfolio_type"> <option value=""><?php echo ..

Read more