Skip to content

Tag: loops

Skipping an index in foreach loop

I’ve seen options for only hitting certain numbers in a foreach (if i < 25, etc) but I’m wondering how to best skip a string index completely I have a loop that works perfectly and I don’t want to change what it’s doing, I just want to omit one row that has the index of ’emplo…

How to work json string on foreach loop in php

I’m trying to make a foreach loop from string value which comes from a JSON value like: I want to make a foreach loop and echo URL under the loop I have tried using this but it returns PHP Warning: Invalid argument supplied for foreach() Answer Your input is a string, so we need transform it to array fo…

Parse multidimensional array PHP

I have the following PHP array output: I am trying to find the best way to format this into the below table structure: I need the loop to be flexible enough to write a new table with header for each sub array. What is the best way to loop through this array to output new tables and header for each

ajax select data with multiple related data

i want to show checkbox looping from db, if i try to select data id_kendaraan in field then show the data from that id. this my view code: my controller: i get data from view $id_kendaraan for my parameter. this my model: but if i try this code, field tahun_beli, id jenis is success to showing in the view. bu…

output common int using array_search

I am trying to create a function that will output the smallest common int or return false if there is not one in three arrays. The arrays are sorted ascending and I want to do with array_search. When I execute this code it returns nothing and I don’t know why it should echo 5 I think Answer Here is a