There is a code of a parser of pictures from one table in a DB:

preg_match_all('/<var class="postImg postImgAligned img-(.*?)" title="(.*?)">.*?<\/var>/', $rowr[$i]['post_html'], $poster, PREG_SET_ORDER); 

And the output of the result:

 $urlImg = 'images/no_logo.png'; if (@$poster[0][2]) { $urlImg = $poster[0][2]; } 

Subject to the presence of the picture, in fact, it is shown, if the picture is missing, the default picture no_logo.png and a notice appears

Notice: Undefined offset: 3 in ****** \ index.php on line 150

150 line this is the parser. What do I need to add, so that the notes do not crumble?

  • @$poster[0][2] -> isset($poster[0][2]) ? - Visman
  • The notes are gone, but the default images are no longer displayed. - Alex31
  • Based on the presented code, such a replacement could not affect the disappearance of the default image. - Visman
  • I'm sorry. Default pictures remained as well as notes. In general, nothing has changed - Alex31

0