Jump to content

string with an integer concatenation problem


jimfog

Recommended Posts

I want to concatenate a string with an INT...if I do that...the result is a string...for example:

$int=5;'john'.$int;//this will output 'john5'

I want this though:

$int=5;'john'.$int;//this will output 'john'5

In other words...the integer remains an integer...no casting taking place.Is that possible?

 

Link to comment
Share on other sites

The result of a concatenation can only be a string. A value cannot be of two different types at the same time.

 

Perhaps an array will do what you want:

array('john', 5);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...