המערך שיצא
קוד: בחירת הכל
Array ( [0534100432] => Array ( [name] => מנחם ) [089493770] => Array ( [name] => נחייג ונשמע ) [0] => Array ( [Folder] => 000 [Phone] => 0534100432 [Date] => 26/05/2018 [Time] => 22:02:30 ) [1] => Array ( [Folder] => 770 [Phone] => 0534100432 [Date] => 26/05/2018 [Time] => 22:02:30 ) )
קוד: בחירת הכל
<?php
$mmf1 = '000.Phone-0534100432.Date-2018-05-26.22:02:30
770.Phone-0534100432.Date-2018-05-26.22:02:30';
foreach( explode("\r\n" , $mmf1) as $row) {
$data_row = explode("." , $row ) ;
$info = array();
foreach( $data_row as $data ) {
$data = explode ( '-' , $data );
switch ( count($data) ){
case 1 :
$key = strpos( $data[0] , ':' )? 'Time' : 'Folder' ;
$value = $data[0] ;
break ;
case 2 :
$key = $data[0] ;
$value = $data[1] ;
break ;
case 4 :
$key = $data[0] ;
$value = $data[3] . '/' . $data[2] . '/' . $data[1] ;
}
$info[$key] = $value ;
}
$mmf2='0534100432=מנחם
089493770=נחייג ונשמע' ;
foreach ( explode ("\r\n" , $mmf2 ) as $row ){
$row = explode ( '=' , $row ) ;
$all_info[$row[0]]['name'] = $row[1] ;
}
{ $all_info[] = $info;}
}
print_r($all_info);
//foreach ($all_info as $info) {
//echo "שם : ";
//echo $name;
//echo " , טלפון : ";
//echo $info['Phone'];