Reputation: 2434
I have an file. Each value looks like this:
Peter | Stuart | 10293 | 13/02/93 | [email protected] | [data6] | [data7] | [data8]
My question is, I want data 6, 7 and 8 to be in seperate variables.
So the variable would be like this (in PHP code)
$data6 = [data6]
$data7 = [data7]
$data8 = [data8]
Does that make sense? I understand a loop will be involved, it is more getting the data in between the "|" symbol I am not 100% sure about.
Thanks Peter
Upvotes: 0
Views: 57
Reputation: 6051
you can use explode:
$data_array = explode("|",$your_string);
then you can access those values like any other array:
$data_array[5]; // this would be data 6
Upvotes: 3