Results 1 to 3 of 3

Thread: help in php

  1. #1
    Join Date
    Feb 2007
    Location
    barranquilla, colombia
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help in php

    I have in a input text the following information:
    Friday, February 9, 2007.

    I want to extract of there on Friday.

    I appreciate a prompt help...


  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
      function analizarFecha($fecha) {
        $d = array(1 => 'día', 'mes', 'fecha', 'año');
        $r = array();
        $m = array();
        preg_match('/(\w+), (\w+) (\d+), (\d+)/', $fecha, $m);
        foreach($m as $k => $v)
          if(isset($d[$k])) $r[$d[$k]] = $v;
        return $r;
      }
    
      $fecha = analizarFecha($_GET['fecha']);
      print $fecha['día']; // "Friday"
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Feb 2007
    Location
    barranquilla, colombia
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok thank you for your help...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •