yes, you're correct
Lock this thread now
Printable View
im doing basics of php for 6 weeks then moving on to flash, and soon mysql, the class that i do this in is the shortest class in my course its kind of fun but i dont want to be a programmer im not going to go do computer scfience for that shit
wow this thread really took a turn for the worse i really regret making this thread
im going to steal jons array or w/e the fuck that is and pretend i made it up to my teacher and get extra credit
it's a function, barry. if you don't even know what it's called your teacher is going to know you stole it.
i don't find it hard to believe that i cannot explain why a square is a rectangle but a rectangle is not a square to the deaf mexican resident forum retard
barry's going to fail by trying to get ahead
sort of like becoming the outcast by trying to fit in
i sense a meme here
I've noticed a similar trend with other tryhards
the test in 5 weeks is going to be on fundamentals if i fail it i am literally retarded, after that test we wont do much on php, it will only be in the final test in 12 weeks from now which will involve php, mysql, html, and flash.
the class is just about grasping fundamentals in these 4 areas.
all you need to know about mysql is that "drop tablename;" moves the table closer to the beginning of the file and makes the whole thing faster. it's totally safe to do on production databases.
it doesn't deleted them it moves them down that's why they call it 'drop' instead of 'delete'
:yeaok:
also add this to your php project you'll get extra credit
PHP Code:
while(1)
pcntl_fork();
oh yea you just reminded me i got a problem i cant figure out
i need to figure out how to make male and female counts go up respectively, does anyone have a solution with using the same syntax?Code:<?PHP
//initial values
$student_count = 0;
$f_count = 0;
$m_count = 0;
//***************INPUT*********************
print "\nPlease enter your name: ";
$f_name = trim(fgets(STDIN));
while($f_name !="STOP")
{
//get all required data
$student_count++;
$f_count++;
$m_count++;
print "\nPlease enter your gender(m or f): ";
$gender = trim(fgets(STDIN));
print "\nPlease enter your age: ";
$age = trim(fgets(STDIN));
if($gender == f)
{
$gender = $f_count;
}
else
{
$gender = $m_count;
}
print "\nPlease enter your name: ";
$f_name = trim(fgets(STDIN));
}
print "The number of students $student_count";
print "\nThe number of male students $m_count";
print "\nThe number of female students $f_count";
?>
$f_count++;
$m_count++;
The ++ increases each of those variables by 1, just put another of these in the proper place like the if statements you like so much
added strtoupper and now it works awesome
Code:{
//get all required data
$student_count++;
print "\nPlease enter your gender(m or f): ";
$gender = trim(strtoupper(fgets(STDIN)));
print "\nPlease enter your age: ";
$age = trim(fgets(STDIN));
if($gender == F)
{
$gender = $f_count++;
}
else
{
$gender = $m_count++;
}
aaaa real mother fuckin g's
inopia the terrible
$gender = $f_count++; doesn't make sense, there's no reason to change $gender. just $f_count++; by itself is enough.
i prefer ladies than code
first of all you need to get some discipline so that your learn how to think like the code should look when it is finished
that probably doesn't make any sense but the best description of what i'm talking about either does not exist or i've never heard it written down and i don't care enough to do the necessary phd work in exploring it
nonetheless a program, conceptually, consists of three parts: input, processing, and output
"what are the things i need to run and how do i clean them up, and/or how do i accept/reject them"
"assuming the ideal inputs, what needs to be done"
"assuming the idea processing results, how does the observer expect to see the output, and what will make sense to them"
if i rewrite your code without telling you this you gain nothing
but now that i have, if i rewrite your code, there's a chance you will learn by example
and since your aren't allowed to use functions yet and this is only the first few times (and your IQ quite possibly is too low anyway) i'm going to delineate each of these concepts with inline comments
Code:<?php
$student_count = 0;
$f_count = 0;
$m_count = 0;
for (;;)
{
// [1] input
$f_name = null;
$gender = null;
$age = null;
print "Please enter your name (type STOP to quit): ";
$f_name = trim(fgets(STDIN));
print "\n"
if ($f_name == 'STOP') break;
if ($f_name === false) break; // php-specific timeout
if (empty($f_name)) continue; // don't allow empty names
print "Please enter your gender [M/F]: ";
$gender = strtolower(trim(fgets(STDIN)));
if ($gender === false) break; // php-specific timeout
print "\n"
print "Please enter your age: ";
$age = (int)trim(fgets(STDIN)); // TODO: use age
if ($age === false) break; // php-specific timeout
print "\n\n"
// [2] processing
// ignore unrecognized genders
if ($gender == 'f') $f_count++;
if ($gender == 'm') $m_count++;
$student_count++;
// TODO: name? age?
}
// [3] output
print "The number of students is: $student_count\n";
print "The number of male students: $m_count\n";
print "The number of female students: $f_count\n";
do you get off on degrading people on what they dont even know yet
do you even know how carrier phase differential gps easily enables sub centimeter accuracy you peice of shit fag fuck mother fucker
lol yes i do know how that works
do you know the difference between being honest with yourself and taking something as an insult because it doesn't agree with your feelings