Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Don Shipley
19,488 PointsWhat is concatenate?
Inside of the my_plugin_get_profile function, create a variable named "json_feed_url" that concatenates the domain name http://myapi.net with the my_plugin_username variable and appends ".json" to the end.
4 Answers

Kristen Law
16,244 PointsThe question is asked correctly. It's asking you to concatenate (link together/combine) the domain name with $my_plugin_username
and then add '.json'
to the end, which looks like this: 'http://myapi.net/' . $my_plugin_username . '.json'
. It then wants you to assign that code to $json_feed_url
. I agree that the wording is slightly confusing, but it is worded correctly.

Leroy Sibisi
20,619 PointsThank you very much Kristen. I passed the challenge!

Andres Ramirez
18,094 Points<?php
function my_plugin_get_profile($my_plugin_username) {
$json_feed_url = 'http://myapi.net/'.$my_plugin_username.'.json';
}
?>

Shea Cole
7,836 PointsThis got mine to pass:
function my_plugin_get_profile($my_plugin_username){ $json_feed_url = '"http://myapi.net" . {$my_plugin_username} . ".json"'; }
And then I saw that I didn't have the "/" after .net . It does need that, so I'm not sure why it let my code through!
Leroy Sibisi
20,619 PointsLeroy Sibisi
20,619 PointsHi,
I tried your method, but it is not passing.
function my_plugin_get_profile($my_plugin_username) { $json_feed_url = 'http://myapi.net'.'my_plugin_username'.'json'; }
Kristen Law
16,244 PointsKristen Law
16,244 PointsHey Leroy Sibisi! You're pretty close! Take a closer look at what you are assigning to
$json_feed_url
. You're concatenating three strings:'http://myapi.net'
,'my_plugin_username'
, and'json'
. Remember we want$json_feed_url
to be equal to a url of the form "http://myapi.net/MikeTheFrog.json", for example, if "MikeTheFrog" is passed into the function. So you would want to concatenate the string'http://myapi.net/'
(don't forget the last slash "/"!), the variable$my_plugin_username
(not a string!), and the string'.json'
(don't forget the dot in front "."!). Hope that helps! :)