Is there a way to make php make this piece of code:
myclass.randomthingwrittenhere
work as
myclass.nexttodotoperator(randomthingwrittenhere)?
I want to write my own database framework to databases and im wondering if it can work somehow.
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.
Accessing members on objects?
I’m really not sure what you’re doing in your example. When you access properties or call methods on objects you use the
->syntax, unlike JavaScript which can use..There are a few magic methods that you can add to your class to handle this:
In this code, any instance of the class will let you handle requests for members that aren’t found on the instance itself.
Demo: http://codepad.org/3qB8gXfv
String manipulation?
That being said, perhaps you’re not asking about classes at all, but instead string manipulation. If I understand your question correctly, provide your input string:
Then split up the two parts into your class, and your method:
Then spit out the new string, interpolating the variables:
Demo: http://codepad.org/vggOIA9U