Hi all,
i'm writing a custom code to export a CSV file of products in a database. Here is the idea:
1) A textfield in the web page. It will contain user's choices.
2) A list of allowed tags
3) Unknown separators
Assuming that my database contains only a product(Chair),if user writes :
tag_stock|tag_productname|tag_category
the CSV file will contain :
2|Chair|Furniture
Obiviously, it should be done for every product in my database.
For example, a full CSV file should contain:
2|Chair|Furniture|10|Hammer|Tools|10|Sickle|Tools|... and so on
User defined order must be respected.
The algorithm i thought is something like this
$ops = array("product","chair","furniture") //contains the order of the tags read from the string
foreach(product of my catalog) {
for(i = 0 ; i< ops.lenght ; i++)
Read ops
Execute function contained in ops
}
So here are my questions
1) How can i read multiple tokens sequencely from a string?
2) Is there a way to invoke a function by reading the name from a variable?
Thank you very much. Hints or advices are well accepted 😃