3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function getKeywordsForURL($link_platform_product_page, $target_locale_iso, $language) { $keywords = []; if (empty($keywords)) { // Only page URL was specified, so use a UrlSeed. $requestOptionalArgs['urlSeed'] = new UrlSeed(['url' => new StringValue(['value' => $link_platform_product_page])]); } elseif (is_null($link_platform_product_page)) { // Only keywords were specified, so use a KeywordSeed. $requestOptionalArgs['keywordSeed'] = new KeywordSeed([ 'keywords' => array_map(function ($keyword) { return new StringValue(['value' => $keyword]); }, $keywords) ]); } else { // Both page URL and keywords were specified, so use a KeywordAndUrlSeed. $requestOptionalArgs['keywordAndUrlSeed'] = new KeywordAndUrlSeed([ 'url' => new StringValue(['value' => $link_platform_product_page]), 'keywords' => array_map(function ($keyword) { return new StringValue(['value' => $keyword]); }, $keywords) ]); } // Create a list of geo target constants based on the resource name of specified location // IDs. $geoTargetConstants = array_map(function ($locationId) { return new StringValue( ['value' => ResourceNames::forGeoTargetConstant($locationId)] ); }, $locationIds); // Generate keyword ideas based on the specified parameters. $response = $keywordPlanIdeaServiceClient->generateKeywordIdeas( $customerId, // Set the language resource using the provided language ID. new StringValue(['value' => ResourceNames::forLanguageConstant($language)]), // Add the resource name of each location ID to the request. $geoTargetConstants, // Set the network. To restrict to only Google Search, change the parameter below to // KeywordPlanNetwork::GOOGLE_SEARCH. KeywordPlanNetwork::GOOGLE_SEARCH_AND_PARTNERS, $requestOptionalArgs ); $keywords = ""; // Iterate over the results and print its detail. foreach ($response->getResults() as $result) { if ($result->getKeywordIdeaMetrics()->getAvgMonthlySearches()->getValue() > 10) { printf( "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 ); $keywords .= $result->getText()->getValue() . ","; } } return $keywords ;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.50.0100.01016.02
7.4.40.0060.01316.27
7.4.30.0090.00916.28
7.4.20.0030.01316.01
7.4.10.0050.01316.19
7.4.00.0120.00616.36
7.3.170.0130.00616.14
7.3.160.0100.00616.39
7.3.150.0060.01216.23
7.3.140.0090.01216.16
7.3.130.0070.01016.14
7.3.120.0030.01616.04
7.3.110.0060.00916.11
7.3.100.0120.00316.14
7.3.90.0090.00716.20
7.3.80.0100.00716.21
7.3.70.0140.00716.00
7.3.60.0060.01016.16
7.3.50.0090.00616.11
7.3.40.0070.01016.24
7.3.30.0090.00616.18
7.3.20.0450.00316.37
7.3.10.0100.00716.23
7.3.00.0060.01016.05
7.2.290.0130.00616.28
7.2.280.0070.01116.21
7.2.270.0030.01416.07
7.2.260.0090.00916.20
7.2.250.0080.00816.47
7.2.240.0060.01216.38
7.2.230.0120.00616.48
7.2.220.0180.00016.17
7.2.210.0100.00616.27
7.2.200.0090.01316.18
7.2.190.0070.01116.35
7.2.180.0060.01116.41
7.2.170.0030.01316.54
7.2.160.0100.00716.27
7.2.150.0120.00616.34
7.2.140.0110.00616.34
7.2.130.0030.01416.28
7.2.120.0100.01016.17
7.2.110.0080.01316.35
7.2.100.0060.01316.39
7.2.90.0080.01116.50
7.2.80.0030.01616.21
7.2.70.0030.01616.32
7.2.60.0090.00916.23
7.2.50.0030.01316.41
7.2.40.0070.01016.41
7.2.30.0120.01316.17
7.2.20.0040.01716.50
7.2.10.0030.01316.32
7.2.00.0060.01216.29

preferences:
154.55 ms | 1308 KiB | 7 Q