Skip to content
Advertisement

Tag: arrays

Trying to get array from form post but not working correcty

I am building an application with php I have a form which contains an array of checkboxes as shown in the picture below I want to the values accordingly but it is not working as expected The form was generated with php for loop HTML I am trying to get the selected values but not working as expected. leaked_no shows

Laravel 9 Array Filter

I have this array cart_items and works fine when mapped for database storage as in the code. I need to filter the array using Arr:where(), where the product shop_id is a specific value. I tried using an if function but the code just looped returing true where the shop_id was present. I need to filter the array where the product

How to I get a range of times from a start time and end times with an hour difference using PHP?

$course_hour = 1; $starttime = ’07:00′; $endtime = ’16:00′; I wish if it could return an array of values like below: If $return_array = array(’07:00 – 08:00′, ’08:00 – 09:00′, ’09:00 – 10:00′, ’10:00 – 11:00′, ’11:00 – 12:00′, ’12:00 – 13:00′, ’13:00 – 14:00′, ’14:00 – 15:00′, ’15:00 – 16:00′); If $return_array = array(’07:00 – 08:30′, ‘8:30 – 10:00’,

Get occurences of an object in an object array PHP

I have a large array with several objects, where there are several duplicates for them. I got an unique array using array_unique(PHP). Now, I need to know how to get how manny times each object was there in the original array? I have tried array_search, and loops but nothing got the correct results. Some what similar array like here, but

How to sum php array that have same key but different sensitivity

I want to sum the value of keys that are the same but in diffrent case. Let’s say we have this array Answer Loop through the keys and values. Convert each key to uppercase. In a 2nd array, set the key/value to the sum of the current value in that array (or 0 if it doesn’t exist) plus the value

Advertisement