0

I want to count all Arrays together but dont know my Problem

$output = array(
    'facebook'=> isset($finfo[0]) ? $finfo[0]->total_count : NULL,
    'twitter'=> isset($tinfo->count) ? $tinfo->count : NULL,
    'delicious'=> isset($dinfo[0]) ? $dinfo[0]->total_posts : NULL,
    'pinterest'=> isset($pinfo->count) ? $pinfo->count : NULL,
    'googlePlus'=> isset($gplus[0]['result']) ? $gplus[0]['result']['metadata']['globalCounts']['count'] : NULL

);

function getSocialCount($output){
    return json_encode($output[facebook]) + json_encode($output[twitter]) + json_encode($output[pinterest]) + json_encode($output[googlePlus]);
}

<div>All: <?php echo getSocialCount(); ?></div>

Am I writing the Syntax wrong?

2 Answers 2

1

Yes, your function expects one parameter and you are not giving it any.

Change:

 <?php echo getSocialCount(); ?>

to:

 <?php echo getSocialCount($output); ?>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks jeroen. 4 eyes see better than 2 eyes ;)
0

Maybe you should add your array $output into your function..

<?php echo getSocialCount($output); ?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.