I’m trying to search through this Json array using PHP:
{"count":"2","items":{"milestone":[{"id":"3107","username":"TomSmith1","userid":"1620602","date":"2012-01-12 16:49:26","projectid":"804","projectname":"TEST PROJECT","reason":"Partial payment for project","amount":"25","currency":"1"},{"id":"3111","username":"HarryCole","userid":"1620603","date":"2012-01-13 16:42:39","projectid":"804","projectname":"TEST PROJECT 2","reason":"Partial payment for project","amount":"10","currency":"1"}]}}
I want to search through this to find the “id”, which has the project name “TEST PROJECT 2” and the username “HarryCole”. I’ve attempted this using a foreach loop but haven’t succeeded. Can anyone point me in the right direction? Thanks.
You’re going to need https://www.php.net/json_decode and also a foreach loop like