Reputation: 19
I want the output to be concatenating the two variables I have.
The $out [1]
is now echo: /home/data/main/folders/folder1/size1
The $arr[$folder_name] [1]
is echo folder1
I want the echo for $newfoldername
to be /home/data/main/folders/folder1/size1_folder1
$newfoldername = $out [1] . '_' $arr[$folder_name];
echo $out [1] ;
echo $arr[$folder_name] [1] ;
rename ( $out [1] , $newfoldername ) ;
Upvotes: 0
Views: 184
Reputation: 19
This was the correct solution for me:
$newfoldername = substr( $out [1], 0, -1 ) . "_" . $arr[$folder_name];
Upvotes: 0
Reputation: 180
For short you can just:
rename ($out[1], $out[1].'_'.$arr[$folder_name] );
Or echo that:
echo $out[1].'_'.$arr[$folder_name];
Careful with syntax when sharing problems, it might be the source of the problem. But your IDE should have showed you.
Upvotes: 0
Reputation: 21
I do not understand the question, but you have mistake in this string
$newfoldername = $out [1] . '_' $arr[$folder_name];
take this code. it is whithout mistakes;
$newfoldername = $out [1] . '_' . $arr[$folder_name];
Upvotes: 2