---
title: "problem med array"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/101079-problem-med-array"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "mify"
published: "2004-04-06T19:26:27.000Z"
updated: "2004-04-06T19:56:51.000Z"
replies: 1
views: 201
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/101079-problem-med-array"
---

# problem med array

## #1 — mify, 2004-04-06T19:26Z

hittade följande kod som jag tänkte använda och det funkar bra ändå tills jag lägger till TV4+ också i strängen då får jag helt plötsligt TV4 som resultat 2 ggr fattar inte hur jag ska göra för att den ska förstå att det är olika. Tacksam om någon har ett tips

\<?php
/\*\*
 \* - TV.just.nu - Vad som visas på TV just nu
 \* - Version 0.4 - xxxx-xx-xx -
 \*
 \* - Thanks <https://www.phpportalen.net> and the people there for all help!
 \* - Henrik Caesar \<henrik.caesar@telia.com\>
 \*/
 
   $url = "http://tvprogram.nu/cgi-tvprogram/pp1.cgi?NU-palmpilot.htm";
 
   $fp = fopen("$url", "r") or die("Cannot connect to " . $url);
   while (!feof ($fp))
      $page .= fgets($fp, 6144);
 
   fclose($fp);
 
   $page = strip_tags($page);
 
   echo strftime("%y%m%d - %H:%M:%S") . "\<BR\>\<BR\>"; 
 
   $channels = array('SVT1', 'SVT2', 'TV3', 'TV4', 'KANAL5', 'TV6', 'TV8', 'ZTV');
 
   foreach($channels as $val){
      preg_match("/($val.\*)\\n(.\*)/", $page, $chaninfo);
 
      for($a = 1; $a \< count($chaninfo); $a++){
         if($a == 1)
            echo "\<strong\>" . $chaninfo\[$a\] . "\</strong\>";
         else
            echo $chaninfo\[$a\] . "\<br\>";
 
         echo "\<br\>";
      }
   }
?\>

Permalänk: https://www.webforum.nu/p/101079

## #2 — mify, 2004-04-06T19:56Z

löst genom att skriva TV4\\+

// Micke

Permalänk: https://www.webforum.nu/p/1317980

---

Tråden på webben: https://www.webforum.nu/amne/php/101079-problem-med-array
