Home Find a Zodiac Sign by Birthdate with PHP

    Find a Zodiac Sign by Birthdate with PHP


    Here’s some very simple code that’ll determine a Zodiac sign given a birthdate. If I’ve screwed up on dates, let me know.


    When we posted this on Internoetics we had a number of comments – most of them relating to the date grouping.

    Date Formats

    For an 8-figure time-group (20131220), YYYYMMDD, remove the following line:

    … and use the following:

    You could also use PHP’s str_split as an alternative the preg_match. Using str_split($date, 2); will split a string into an array with the values having a length of 2 characters. Remember, it’s only the two-figure day and month that we’re after.

    Short URL for this post: http://shor.tt/1XI4