Well, I'm 5 weeks before in PHP class, and my teacher don't know what I should do, neither do I.
Can anyone give me something to do that will take around 60 - 80 minutes?
do you mean behind? if so, try tizag.com
its a great html, java, php, and php/mysql tutorial website
Hey vigge, haven't seen you in a while... *cough* long while *cough*
If you don't say what you already know in php it's quite hard for anyone to give you an idea of something to do. Just think of something you might be able to make (or maybe it's more fun if you think you won't be able to make it) and make it.
If you need a function, don't know how to do something or things like that there's a very useful site www.php.net ;)
Real programmers don't document their code - if it was hard to write, it should be hard to understand.
Long time, no see :D
I know for loops, while loops, if cases, switch, functions, math, basic SQL (insert, select, order), Own sorting algorithm.
So all basic, you know.
My teacher gave me to solve the fibonacci numbers and primes up to 100, which I both did in 1 lesson.
build your own software in the time that others are learning it :P. your teacher can grade you on that, depending on how much they actually know about it.
talk it over or see what college level classes are teaching ;)
Fibonacci is too easy =/
Prime numbers are more of a challenge, because there's no way to determine whether a number is a prime number based on the previous number... The only way I can see to do that is brute force...
But... numbers are boring, it's always the same ^^
It's much more interesting to build something that is dependant on user input. If your scripts don't have a time limit you could dive into plain sockets and let 2 scripts communicate with each other (one acting as a server, one acting as a client). It gets even more fun when you combine 2 languages like that, but I doubt your php teacher will like that
I've got something a friend told me once that you can make. You know that total bs where they determine the love % between two people? It's not a random number...
This is how it works, based on an example:
Name 1: imnotanoob
Name 2: yesyouare
You count the amount of times each letter is in the names:
#a: 2
#b: 1
#e: 2
#i: 1
#m: 1
#n: 2
#o: 4
#r: 1
#s: 1
#t: 1
#u: 1
#y: 2
In Array-form: (2, 1, 2, 1, 1, 2, 4, 1, 1, 1, 1, 2)
Then you take the first and the last letter (of the letters which are available) and you add that to a new array. (If the number of available letters is odd, you just leave the middle one (eg. (1, 1, 1) => (2, 1))
The example becomes then: (4, 2, 3, 2, 2, 6)
Just repeat that, and when the number exceeds 9, you take the ciphers and count them together to get a new number (eg. 12 => 1+2 = 3)
(10, 4, 5) => (1, 4, 5)
Eventually you only have 2 numbers left, that's the actual result:
(6, 4)
(Guess how many times you get something with an 0 in it? 0 times ;))
So the love % between imnotanoob and yesyouare would be 64%.
Have fun programming ;)
Or you could just try to recreate my signature =P
Real programmers don't document their code - if it was hard to write, it should be hard to understand.
There are actually some very clever methods to somewhat reduce the time needed to determine whether or not a number is prime, although understanding how some of them actually work requires an upper-class college or graduate level mathematics background.
I agree, if you're just trying to learn PHP, writing math programs is probably more depressing than useful.But... numbers are boring, it's always the same ^^
Yep, also agree.It's much more interesting to build something that is dependant on user input.
If his teacher is any good he'll be most impressed and encourage him.If your scripts don't have a time limit you could dive into plain sockets and let 2 scripts communicate with each other (one acting as a server, one acting as a client). It gets even more fun when you combine 2 languages like that, but I doubt your php teacher will like that![]()
---Joel
PHP Code:function isPrime($i)
{
if($i % 2 != 1) return false;
$d = 3;
$x = sqrt($i);
while ($i % $d != 0 && $d < $x) $d += 2;
return (($i % $d == 0 && $i != $d) * 1) == 0 ? true : false;
}
for($i = 0; $i <= 100; $i++){
$No[$i] = $i;
if(isPrime($No[$i])) {
echo "$i<br />";
}
}
:/
My teacher didn't accept that solution. I hope he accepts this, which I wrote all by myself:
PHP Code:for($i = 0; $i <= 100; $i++){
$No[$i] = $i;
$True = true;
$True2 = true;
if(is_int($No[$i]/2)) {
$True = false;
$No[$i] = -1;
}
if($True) {
if(is_int($No[$i]/3)) {
$True2 = false;
$No[$i] = -1;
}
}
if($True2) {
if(is_int($No[$i]/5)) {
$No[$i] = -1;
}
}
if($No[$i] == 1) {
$No[$i] = -1;
}
$No[2] = 2;
$No[3] = 3;
$No[5] = 5;
$No[49] = -1;
$No[77] = -1;
$No[91] = -1;
if($No[$i] > 0) {
echo $No[$i]."<br />";
}
}