Let’s say I have a windows path name “E:\Dropbox\b\c\d”, when I want to change this path to UNIX with some modifications, I can use this python code.
x = "E:\\Dropbox\\b\\c\\d"
print "/Users/prosseek/" + '/'.join(x.split('\\')[1:])
>> /Users/prosseek/Dropbox/b/c/d
What could be the equivalent code in PHP?
Here you go. You could use
explodeandimplode, but there’s no real reason to get fancy and use arrays when this is just a basic string operation: