I need some help with my code, I have a trouble with checking on two different strings as I want to check if the string in the variable $program_times are equal to PM and $next_program_times are equal to AM. When I try it, it will show nothing and it won't do anything at all.
When I tried this:
if(strpos($program_times, 'PM') !== false && strpos($next_program_times, 'AM') !== false) 
{
  echo 'hello 4';
}
And I have also tried this:
if (strpos($next_program_times, 'AM') !== false) 
{
  echo 'hello 3';
}
Here is the full code:
for ($jj = 1; $jj <= 113; $jj++)
{
  $program_title = $html->find("li[id=row$ii-$jj]", 0)->plaintext; // with this
  $program_title = preg_split("/ {6,}/",$program_title);
  $program_times = $program_title[1];
  if (!empty($program_titles)) 
  {
    $program_times = (new Datetime($program_times))->add(new DateInterval('PT5H'))->format('g:i A');
    echo '<span id="time', $show_id, '">', $program_times, '</span> ', '<span id="title', $show_id, '">', $program_titles, $program_bbf, $program_cat, '</span> <br></br>';
    $next_program_times = $program_times + 1;
    if (strpos($next_program_times, 'AM') !== false) 
    {
      echo 'hello 3';
    }
    if(strpos($program_times, 'PM') !== false && strpos($next_program_times, 'AM') !== false) 
    {
      echo 'hello 4';
    }
Here is the output:
10:00 PM Reba - To Tell the Truth 
10:30 PM Reba - Brock's Mulligan 
11:00 PM Job or No Job - Chicago Restaurants 
12:00 AM Bruce Almighty 
2:00 AM 17 Again 
4:00 AM The 700 Club 
5:00 AM Beetlejuice 
7:00 AM Sexy in 3 Weeks! 
7:30 AM Paid Programming 
8:00 AM The 700 Club 
Can you please show me an example of how I can check the strings between PM and AM before I could do something?
 
     
     
     
    