PHP Print Numbering without using Loop

1. <?php print implode("
“, range(1, 10)); ?>

Response:
1
2
3
4
5
6
7
8
9
10

2.

Response: Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 )

3.

Response: [1,2,3,4,5,6,7,8,9,10]

4. <?php echo implode("
“, array_keys(array_fill(1, 10, 0))); ?>

Response:
1
2
3
4
5
6
7
8
9
10

Advertisements

About amitsonikhandwa
I am a web developer working in PHP and MYSQL with AJAX, jQuery and JavaScript. I am in web development since 2007.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s