anonymous
  • anonymous
New tutorial on PHP contents: 1.Logical operators. 2.while loop 3.foreach loop
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
LOGICAL OPERATORS: Logical operators are typically used with Boolean (logical) values; when they are, they return a Boolean value. However, the && and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value. TYPES OF LOGICAL OPERATORS: $a and $b And TRUE if both $a and $b are TRUE. $a or $b Or TRUE if either $a or $b is TRUE. $a xor $b Xor TRUE if either $a or $b is TRUE, but not both. ! $a Not TRUE if $a is not TRUE. $a && $b And TRUE if both $a and $b are TRUE. $a || $b Or TRUE if either $a or $b is TRUE.
anonymous
  • anonymous
lets see examples:
anonymous
  • anonymous
WHILE LOOP: while loops are the simplest type of loop in PHP. They behave just like their C counterparts. The basic form of a while statement is: while (expr) statement The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration). Sometimes, if the while expression evaluates to FALSE from the very beginning, the nested statement(s) won't even be run once. Like with the if statement, you can group multiple statements within the same while loop by surrounding a group of statements with curly braces, or by using the alternate syntax: while (expr): statement ... endwhile;

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Lets see an example: the working of while loop can be seen in the above example.
anonymous
  • anonymous
FOREACH LOOP: The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes: 1.foreach (array_expression as $value) statement 2.foreach (array_expression as $key => $value) statement The first form loops over the array given by array_expression. On each iteration, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next iteration, you'll be looking at the next element). The second form will additionally assign the current element's key to the $key variable on each iteration. Lets see an example:
anonymous
  • anonymous
Example 1: Example 2: NOTE: Reference of a $value and the last array element remain even after the foreach loop. It is recommended to destroy it by unset().
anonymous
  • anonymous
So thats it for this tutorial. Do comment on the tutorial.
anonymous
  • anonymous
good one !
anonymous
  • anonymous
@Muskan , @mathslover , @MathSofiya @mathhasproblems
anonymous
  • anonymous
thank you @sami-21
nilankshi
  • nilankshi
nice..
anonymous
  • anonymous
@lalaly , @ash2326 , @moha_10 , @malihe
anonymous
  • anonymous
@nilankshi thank you
anonymous
  • anonymous
v nys....gr8 @annas
nilankshi
  • nilankshi
your welcome..@annas
anonymous
  • anonymous
@Muskan thanks
anonymous
  • anonymous
great :D
anonymous
  • anonymous
@Hashir thank you
anonymous
  • anonymous
ur wlc
anonymous
  • anonymous
@apoorvk , @Callisto
ParthKohli
  • ParthKohli
Logical Operators https://developer.mozilla.org/en/JavaScript/Reference/Operators/Logical_Operators While loop: http://php.net/manual/en/control-structures.while.php Foreach loop: http://php.net/manual/en/control-structures.foreach.php Good luck doing it on your own next time.
mathslover
  • mathslover
Wooh ! great tutorial annas. ... I think you are the master here of comp. science .. . thanks agan annas
ParthKohli
  • ParthKohli
@mathslover Just look at the reply above yours.
mathslover
  • mathslover
You mean that this is not personal tutorial ?
ParthKohli
  • ParthKohli
No, it is not; and it hasn't cited the sources. Therefore, this can be called plagiarism. You have the evidence. "plagiarism (noun) The practice of taking someone else's work or ideas and passing them off as one's own." As defined by Dictionary.com
anonymous
  • anonymous
my dear friend parth pointing finger at someone is quite easy... but practically doing something is different i can create a whole new website using php. between i took help from open source php manuals it not so called plagiarism ... so next time try to be more help than that . thank you for your feed back
anonymous
  • anonymous
These are sentences taken to explain topics... i have a question the professor who taught us these subject they also take help from internet are they doing plagiarism too ??? i think not ... because things whose purpose is explain no matter what they are or where they are taken from comes under the category of helping .
mathslover
  • mathslover
gr8 points @annas ..
anonymous
  • anonymous
thanks @mathslover
anonymous
  • anonymous
and one more thing i m just a source to bring stuff to help that has been developed many years ago
farmdawgnation
  • farmdawgnation
@annas I'm afraid Parth has a point. Although you wrote your examples on your own, you did take content from MDN and the PHP manual verbatim without citation, and that's plagiarism. I'm going to let Colm decide how he wants to handle this (either by deleting the question, etc, etc) - but you definitely should not do that again without providing links to the sources in YOUR posts.
anonymous
  • anonymous
ok @farmdawgnation
anonymous
  • anonymous
@cshalvey just want to say one thing php manuals are open source so if i took help to explain some concepts then whats wrong with it alot of people here do such stuff why i m being pointed ?
anonymous
  • anonymous
@Annas - Others *have* been warned about this kind of behavior. The issue here is not that you used the material - as you said, it's open-source so that's fine. The issue is *crediting* the source of this material. Otherwise, it does qualify as plagiarism as it appears you are passing off other people's work as your own. Please remember this in the future, as plagiarism is a very important issue to be aware of - ESPECIALLY now when every source of information is easily available on the internet. Thank you.
anonymous
  • anonymous
wow awesome annas good job
anonymous
  • anonymous
Ok @cshalvey i'll be careful next time.

Looking for something else?

Not the answer you are looking for? Search for more explanations.