I have a problem.I want to get value in dynamic string its so complicated.
This is string
<['pritesh:name:nilesh:replace']>
This is dynamic string and i want to get name and replace variables values in this string.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not exactly sure about the format of your string, but here’s something to get you going.
You can use
explodeto convert a string with delimiters to an array. Then you can change a value and convert it back to a form delimited by, e.g. ":". You do this by usingjoin, which is an alias forimplode:Putting that into a file
example.phpand running it on the command line:As someone mentioned, if you need to handle more advanced formats you should learn how to use regular expressions in PHP.
Hope that helps!