Reputation: 1008
I have a variable
$abc='akr:/9888/fk4f76mhn';
Another variable
$url = 'http://alpha.com/zidd/id/'.$abc;
Which is giving me
http://alpha.com/zidd/id/ akr:/9888/fk4f76mhn
A space is being introduced between id/
and akr:/9888/fk4f76mhn
which I do not want.
Is there anything wrong I am doing here?
Upvotes: 1
Views: 94
Reputation: 2675
I use: preg_replace( '/\s+/', '', $variable)
to remove whitespace from inside a string, and trim, for the start and end. This may help you out.
The $variable
would be the your $url
.
Upvotes: 1
Reputation: 47776
Well you should put quotes around your string literal
$abc = 'akr:/9888/fk4f76mhn';
If you still get a space, you can use trim
to remove it:
$url = 'http://alpha.com/zidd/id/' . trim($abc);
Upvotes: 3