function erstellen und anwenden

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • function erstellen und anwenden

    Hallo.
    Ich möchte gerne eine function erstellen und logischerweise auch anwenden. Leider kommt es nie zu klappen. Wer kann mir helfen.

    Ich lese aus einer DB type datetime den Tag heraus.
    PHP Code:
    $day=date('D'strtotime($row['date'])); 
    und dann
    PHP Code:
    $tag_array = array(
    "Mon" => "Montag",
    "Tue" => "Dienstag",
    "Wed" => "Mittwoch",
    "Thu" => "Donnerstag",
    "Fri" => "Freitag",
    "Sat" => "Samstag",
    "Sun" => "Sonntag");
            
    $tag $tag_array["$day"]; 
    Wie schreibe ich das in eine function()

    und wende das dann auch noch richtig an?
    Es ist sicher ganz einfach aber ich bekomme es nicht hin.

  • #2
    http://de3.php.net/manual/de/language.functions.php

    Comment


    • #3
      PHP Code:
      //könntest für den Weekday auch direkt mysql bemühen
      $sql "SELECT DATE_FORMAT(dateCol,'%a') as tag from table";
      function 
      tagDeutsch($day){
        
      $tag_array = array(
      "Mon" => "Montag",
      "Tue" => "Dienstag",
      "Wed" => "Mittwoch",
      "Thu" => "Donnerstag",
      "Fri" => "Freitag",
      "Sat" => "Samstag",
      "Sun" => "Sonntag");
        return 
      $tag_array[$day];

      in etwa so...

      Gruss

      tobi
      Last edited by jahlives; 02-08-2007, 14:51.
      Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

      [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
      Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

      Comment


      • #4
        setlocale() richtig einstellen, dann gibt strftime mit %A schon das richtige wort zurück.

        Comment


        • #5
          Danke jahlives

          Es funkt supper

          Comment

          Working...
          X