-2

I'm working on a project that uses the Facebook API. Im using methods from that API to automaticly create a username. But for that I need to add the firstname and the lastname.

The way on how I retrieve the firstname and lastnames is:

$userNode->getLastName();
$userNode->getFirstName();

How do I add those return values togheter? If I do this:

$string = $userNode->getFirstName() + $userNode->getLastName();
echo "$string";

the echo shows "0".

Thanks in advance!
Mats de Waard

Mats de Waard
  • 139
  • 2
  • 15
  • 1
    Possible duplicate of [How to combine two strings together?](http://stackoverflow.com/questions/8336858/how-to-combine-two-strings-together) – Egg Mar 11 '16 at 14:53

2 Answers2

1

The first string operators example in the manual will show you:

$string = $userNode->getFirstName() . $userNode->getLastName();
Egg
  • 1,782
  • 1
  • 12
  • 28
0

You need to make a concatenation in php

in your example use "." instead of "+"

$string = $userNode->getFirstName() . $userNode->getLastName();