$result = $data1 . $data2;
This is called string concatenation. Your example lacks a space though, so for that specifically, you would need:
$result = $data1 . ' ' . $data2;
Related Contents:
- How to include a PHP variable inside a MySQL statement
- PHP – concatenate or directly insert variables in string
- How create an array from the output of an array printed with print_r?
- How to generate all permutations of a string in PHP?
- Mixing a PHP variable with a string literal
- Dollar ($) sign in password string treated as variable
- How to get int instead string from form?
- PHP variable interpolation vs concatenation [duplicate]
- How do I check if a string contains a specific word?
- PHP random string generator
- Curly braces in string in PHP
- Parse query string into an array
- How to add elements to an empty array in PHP?
- Send JavaScript variable to PHP variable [duplicate]
- How to evaluate formula passed as string in PHP?
- php – insert a variable in an echo string
- Best way to test for a variable’s existence in PHP; isset() is clearly broken
- PHP variables in anonymous functions
- php variable in html no other way than:
- how to replace special characters with the ones they’re based on in PHP?
- Converting an integer to a string in PHP
- How to split a string by multiple delimiters in PHP?
- How to strip trailing zeros in PHP
- Converting a number (1, 2, 3) to a string (one, two, three) in PHP
- PHP: Best way to extract text within parenthesis?
- PHP remove special character from string
- Storing Form Data as a Session Variable
- Split string by new line characters
- Str_replace for multiple items
- PHP pass variable to include
- How can I capture the result of var_dump to a string?
- Beautiful way to remove GET-variables with PHP?
- What’s the best way to pass a PHP variable to Javascript? [duplicate]
- How to split a long string without breaking words?
- How to handle double quotes in string before XPath evaluation?
- Return the portion of a string before the first occurrence of a character in PHP [duplicate]
- PHP function with variable as default value for a parameter
- Escape string to use in mail()
- Print newline in PHP in single quotes
- How do I remove the last comma from a string using PHP?
- Check string length in PHP
- Php – regular expression to check if the string has chinese chars
- Display possible combinations of string
- Delete first 3 characters and last 3 characters from String PHP
- How to remove the leading character from a string?
- How to convert PascalCase to snake_case?
- How do you pass objects by reference in PHP 5?
- Remove all non-numeric characters from a string; [^0-9] doesn’t match as expected
- How to convert array values to lowercase in PHP?
- PHP Find all occurrences of a substring in a string