Automating the numbers of tags in Array of PHP

14
February 11, 2019, at 11:40 AM

Each tag word has a number value at the end. Like this:

$values = array('tag1','tag2','tag3','tag4','tag5','tag6','tag7','tag8',...);

How can these numbers be generated automatically?

Answer 1

foreach is a simple and clear way to achive what you need. Another option is:

$values = array_map(function($v) { return 'tag' . $v; }, range(1,8));
READ ALSO
What are the image encryption techniques in PHP other than base64? [on hold]

What are the image encryption techniques in PHP other than base64? [on hold]

I want some other techniques to be used to encrypt those images and also how to decrypt and display it on other page

50
How to get resource id on connection establish in ratchet

How to get resource id on connection establish in ratchet

I am using ratchet chat library to create a real-time chat application in PHP CodeIgniterI want to implement one to one chat for which I want to send msg to a particular resource id

13
mysql database check if domain name exists / alive [duplicate]

mysql database check if domain name exists / alive [duplicate]

This question already has an answer here:

19