Is there a syntax like for10 in PHP?

Source: Internet
Author: User
I hope you can understand the question first. {code ...} this is the vb syntax, that is, to do 10 times; php will, and the above process can be done below: {code ...} {code ...} {code ...} {code ...} however, they are all very wordy. Is there a simple way to write them? I hope you can understand the question first,

    for 10        next

This is the vb syntax, that is, 10 times;

If php is used, I will do the following:

for($i=0;$i<=9;$i++){}
for(;$i<=9;){$i++;}
for(;;){    if($i=10)        break;    $i++;}
while($i<=9){    $i++;}

However, they are all very wordy. Is there a simple way to write them?

Reply content:

I hope you can understand the question first,

    for 10        next

This is the vb syntax, that is, 10 times;

If php is used, I will do the following:

for($i=0;$i<=9;$i++){}
for(;$i<=9;){$i++;}
for(;;){    if($i=10)        break;    $i++;}
while($i<=9){    $i++;}

However, they are all very wordy. Is there a simple way to write them?

$i = 10;while($i--) {}

Readable> Simple. A great writer makes readers comfortable.

$a=10;while ($a-->0){    //do something}

It's unnecessary. The code is written to people.
For ($ I = 0; I <= 9; ++ $ I ){}

This is the best.

No, you have all said the syntax, and vb does not have the syntax $ a. $ B, right?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.