I want to return the result printed , to use in other function.

Here is the code:

"Keyword idea text '%s' has %d average monthly searches and competition as %d.%s", $result->getText()->getValue(), is_null($result->getKeywordIdeaMetrics()) ? 0 : $result->getKeywordIdeaMetrics()->getAvgMonthlySearches()->getValue(), is_null($result->getKeywordIdeaMetrics()) ? 0 : $result->getKeywordIdeaMetrics()->getCompetition(), PHP_EOL ); return 

The result is like : Keyword idea text 'a' has 1600 average monthly searches and competition as 4. Keyword idea text 'b' has 10 average monthly searches and competition as 2. Keyword idea text 'c' has 10 average monthly searches and competition as 4.

this is how is printed

i want to return like "a,b,c"

How to store this result in one string and to retunr ....so then i can use in other function

Tag:google-ads-api, php, symfony

Only one comment.

  1. Mhammad Jezzini

    First method:

    return $a . ',' . $b . ',' . $c;

    Second Method

    $arr = [$a, $b, $c]; return implode(",", $arr);

Add a new comment.