Skip to content
Advertisement

Tag: arrays

How to sort an Array using If in PHP

I have the following Array which contains data such as: Card, Month and Year. However, I receive it in a disorganized way and I would like to treat these values to follow the pattern. No Card, Year and Month or Month, Card and Year. I tried to use the sort() functions of php, but without success! I would like to

send post json with php (curl)

i done search tutorial for send post json with curl .. but for this value i cant find in here.. and my question how to convert to array post json in value if like this, and this my value post json i done try to php array like this but still error maybe someone can help me.. and sory for

Compare array values and selecting specific one

I need a bit of help with the below concept. I have an array: I would like to loop through it and select the “first IN” and “last OUT” based on “dateTime”. So I should be getting: How is it possible to achieve this? Appreciate any help. Thanks, Answer The way I would approach this is to: Filter the RAW

Format simpe array in multidimensional

I have a simple array in PHP like this : I want to convert this array in multidimensional width underscore as separator : I can do this with the following uggly code : How can I do this with a pretty function ? Thanks for reply Answer It’s pretty easy to achieve by iterating and adding branch by branch to

How to add element to advanced array inside foreach loop

I am trying to add my data to my array inside my foreach loop. I have almost done it successfully, except the array is too in-depth. It’s showing array->array->{WHAT I WANT} When I need array->{WHAT I WANT} Example, I’m needing it to be like: When at the moment, it’s showing: The code I’m currently using inside my foreach loop is:

Advertisement