codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $file_data = array( 't1|c1|dp1', 't2|c2|dp2', 't3|c3|dp3', ); $file_data_array = array( 'title'=>array(), 'content'=>array(), 'date_posted'=>array() ); //go through each question foreach($file_data as $value) { //separate the string by pipes and place in variables list($title, $content, $date_posted) = explode('|', $value); //create an associative array for each input $file_data_array['title'][] = $title; $file_data_array['content'][] = $content; $file_data_array['date_posted'][] = $date_posted; } print_r($file_data_array); ?>
Private
[
?
]
Run code
Submit