I have decided to set up an array to differentiate certain values. If I look to find a certain value in the array, I'd like to use the rest of the data within this value I have searched:
Array
(
[0] => Array
(
[id] => 123
[0] => Array
(
[name] => Burger Joint
[pluralName] => Burger Joints
[shortName] => Burgers
)
)
[1] => Array
(
[id] => 617
[0] => Array
(
[name] => reeeJoint
[pluralName] => reeeJoints
[shortName] => reee
)
)
[2] => Array
(
[id] => 12355
[0] => Array
(
[name] => LeftJoint
[pluralName] => LeftJoints
[shortName] => Left
)
)
[4] => Array
(
[id] => 526
[0] => Array
(
[name] => asdfJoint
[pluralName] => asdfJoints
[shortName] => asdf
)
)
)
I'd like to do some kind of search where if there's a value with 123
, it will only get a new array with everything in the 123 id array (in this case is the first one).
What is the best practice in finding this?
Thanks!
Edit:
Based on some comments, I was able to come up with a new way of setting my array. However I'm still wondering the same question which way to tackle showing if value exists:
foreach($values as $value)
{
...
$categoriesExtract[$id] = array($category_stringArray2Sugg);
}
gives me this array:
Array
(
[123] => Array
(
[0] => Array
(
[name] => Burger Joint
[pluralName] => Burger Joints
[shortName] => Burgers
)
)
[617] => Array
(
[0] => Array
(
[name] => reeeJoint
[pluralName] => reeeJoints
[shortName] => reee
)
)
[12355] => Array
(
[0] => Array
(
[name] => LeftJoint
[pluralName] => LeftJoints
[shortName] => Left
)
)
[526] => Array
(
[0] => Array
(
[name] => asdfJoint
[pluralName] => asdfJoints
[shortName] => asdf
)
)
)
name,pluralName,shortName
Just getting those data so I can echo out in json format