<?php $datas = [ [ 'article_id' => 1, 'article_title' => ' Article 1', 'article_content' => 'This is some dummy text for the first article.', ], [ 'article_id' => 2, 'article_title' => 'Article 2', 'article_content' => 'This is the content for article #2', ] ]; $linkID = 2; $articles = array_column($datas, null, 'article_id'); if (isset($articles[$linkID])) { list('article_title'=> $title, 'article_content' => $content) = $articles[$linkID]; echo $title . \PHP_EOL; echo $content . \PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.