title: JSON : Fetch Particular row from an array using php
body: <p>Hi there I am trying to fetch a particular data from the JSON format that I have. 
  I am using the prebuilt json for my practice.</p>
  
  <p>The JSON Format is in this way : </p>
  
  <pre><code>[
  {
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio 
   reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et 
  cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt   
  rem eveniet architecto"
  },
  {
  "userId": 1,
  "id": 2,
  "title": "qui est esse",
  "body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor 
  beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil 
  molestiae 
  ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla"
  },
  {
  "userId": 1,
  "id": 3,
  "title": "ea molestias quasi exercitationem repellat qui ipsa sit aut",
  "body": "et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut 
  ad\nvoluptatem doloribus vel accusantium quis pariatur\nmolestiae porro eius 
  odio et labore et velit aut"
  }
  ] 
  </code></pre>
  
  <p>and so on...</p>
  
  <p>So what I have done is I fetched the title array from every Object. </p>
  
  <p>Here is my Code : </p>
  
  <pre><code>&lt;?php
  $url = "https://jsonplaceholder.typicode.com/posts" ;
  //  Initiate curl
  $ch = curl_init() ;
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  $result = curl_exec($ch) ;
  curl_close($ch) ;
  
  $data = json_decode($result);
  
  foreach ($data as $datavalue) {
  echo $datavalue-&gt;title;
  echo "&lt;br/&gt;" ;
  }
  </code></pre>
  
  <p>Now What I want is to show the title of a particular object, Say where user id =2 .</p>
  
  <p>How can I persue that.
  Please Help with my query. Any help is really appreciated.</p>