language: PHP (php 5.4.4)
date: 582 days 13 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
 
$input = Array
(
    0 => Array
        (
            'notecata' => 'Tele Call',
            'user_id' => 1,
            'note_key' => '4977f48e',
            'note_title' => 'Urgent Call to Soorya',
            'note_description' => 'want to discuss about the work',
            'added_on' => '15-11-11'
        ),
 
    '1' => Array
        (
            'notecata' => 'Set PlaceMent Drive',
            'user_id' => 1,
            'note_key' => 'b8b25bd8',
            'note_title' => 'Want to collect biodata from Students',
            'note_description' => 'Soorya must do this very well',
            'added_on' => '15-11-11'
        ),
 
    '2' => Array
        (
            'notecata' => 'Conference',
            'user_id' => 1,
            'note_key' => '3cdb4886',
            'note_title' => 'Sunday Meeting',
            'note_description' => 'About new courses',
            'added_on' => '08-11-11'
        )
 
);
echo"INPUT:<pre>";
print_r($input);
echo "</pre>";
$output = array();
foreach ($input as $k=>$v)
{
        $array_key = $v['added_on'];
        unset($v['added_on']);
        if( array_key_exists($array_key,$output) )
        {
                array_push($output[$array_key],$v);
        }
        else {
                $output[$array_key][] = $v;             
        }       
}
echo"OUTPUT:<pre>";
print_r($output);
echo "</pre>";
 
 
  • upload with new input
  • result: Success     time: 0s    memory: 13112 kB     returned value: 0

    INPUT:<pre>Array
    (
        [0] => Array
            (
                [notecata] => Tele Call
                [user_id] => 1
                [note_key] => 4977f48e
                [note_title] => Urgent Call to Soorya
                [note_description] => want to discuss about the work
                [added_on] => 15-11-11
            )
    
        [1] => Array
            (
                [notecata] => Set PlaceMent Drive
                [user_id] => 1
                [note_key] => b8b25bd8
                [note_title] => Want to collect biodata from Students
                [note_description] => Soorya must do this very well
                [added_on] => 15-11-11
            )
    
        [2] => Array
            (
                [notecata] => Conference
                [user_id] => 1
                [note_key] => 3cdb4886
                [note_title] => Sunday Meeting
                [note_description] => About new courses
                [added_on] => 08-11-11
            )
    
    )
    </pre>OUTPUT:<pre>Array
    (
        [15-11-11] => Array
            (
                [0] => Array
                    (
                        [notecata] => Tele Call
                        [user_id] => 1
                        [note_key] => 4977f48e
                        [note_title] => Urgent Call to Soorya
                        [note_description] => want to discuss about the work
                    )
    
                [1] => Array
                    (
                        [notecata] => Set PlaceMent Drive
                        [user_id] => 1
                        [note_key] => b8b25bd8
                        [note_title] => Want to collect biodata from Students
                        [note_description] => Soorya must do this very well
                    )
    
            )
    
        [08-11-11] => Array
            (
                [0] => Array
                    (
                        [notecata] => Conference
                        [user_id] => 1
                        [note_key] => 3cdb4886
                        [note_title] => Sunday Meeting
                        [note_description] => About new courses
                    )
    
            )
    
    )
    </pre>