Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getRawForTopFive()
- {
- $ad = array
- (
- "0" => array
- (
- "country_id" => 1,
- "speciality_id" => 1,
- "active_doctors" => 11
- ),
- "1" => array
- (
- "country_id" => 1,
- "speciality_id" => 2,
- "active_doctors" => 6
- ),
- "2" => array
- (
- "country_id" => 1,
- "speciality_id" => 4,
- "active_doctors" => 1
- ),
- "3" => array
- (
- "country_id" => 1,
- "speciality_id" => 10,
- "active_doctors" => 1
- ),
- "4" => array
- (
- "country_id" => 2,
- "speciality_id" => 1,
- "active_doctors" => 6
- ),
- "5" => array
- (
- "country_id" => 2,
- "speciality_id" => 2,
- "active_doctors" => 1
- ),
- "6" => array
- (
- "country_id" => 2,
- "speciality_id" => 3,
- "active_doctors" => 1
- ),
- "7" => array
- (
- "country_id" => 2,
- "speciality_id" => 4,
- "active_doctors" => 2
- )
- );
- $pad = array
- (
- "0" => array
- (
- "country_id" => 1,
- "speciality_id" => 1,
- "pending_activation_doctors" => 7
- ),
- "1" => array
- (
- "country_id" => 1,
- "speciality_id" => 2,
- "pending_activation_doctors" => 1
- ),
- "2" => array
- (
- "country_id" => 1,
- "speciality_id" => 8,
- "pending_activation_doctors" => 1
- ),
- "3" => array
- (
- "country_id" => 1,
- "speciality_id" => 10,
- "pending_activation_doctors" => 1
- ),
- "4" => array
- (
- "country_id" => 2,
- "speciality_id" => 1,
- "pending_activation_doctors" => 1
- ),
- "5" => array
- (
- "country_id" => 2,
- "speciality_id" => 4,
- "pending_activation_doctors" => 2
- )
- );
- $is_diff = (count($ad) - count($pad));
- $diff = ($is_diff < 0) ? ($is_diff * -1) : $is_diff;
- for($i = 0; $i < $diff;$i++ ){
- if($is_diff < 0){
- array_push( $ad, array());
- }
- elseif($is_diff > 0){
- array_push($pad,array());
- }
- }
- $out = array();
- foreach ($ad as $key => $value){
- $out[] = (object)array_merge((array)$pad[$key], (array)$value);
- }
- var_dump($out);
- }
Add Comment
Please, Sign In to add comment