A simple PHP function that returns the zodiac sign according to day and month.
-
Click to select it.
<?php
function zodiac($day, $month) {
// returns the zodiac sign according to $day and $month ( https://coursesweb.net/ )
$zodiac = array('', 'Capricorn', 'Aquarius', 'Pisces', 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricorn');
$last_day = array('', 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19);
return ($day > $last_day[$month]) ? $zodiac[$month + 1] : $zodiac[$month];
}
// 15 - October
echo zodiac(15, 10); // Libra
Daily Test with Code Example
HTML
CSS
JavaScript
PHP-MySQL
Which HTML element can be used to embed a SWF flash content?
<object> <div> <script><object type="application/x-shockwave-flash" data="file.swf" width="500" height="250">
<param name="src" value="file.swf" />
Your browser not support SWF.
</object>
Which CSS pseudo-class adds a style to an input form field that has keyboard input focus?
:active :focus :hoverinput:focus {
background-color: #88fe88;
}
Click on the instruction which converts a JSON string into a JavaScript object.
JSON.stringify(javascript_object) object.toString() JSON.parse(json_string)var jsnstr = '{"url": "http://coursesweb.net/", "title": "Web Development Courses"}';
var obj = JSON.parse(jsnstr);
alert(obj.url);
Indicate the PHP function which can be used to create or write a file on server.
fopen() file_put_contents() file_get_contents()if (file_put_contents("file.txt", "content")) echo "The file was created";
else echo "The file can not be created";