us2rn4m2 Posted January 8, 2013 Share Posted January 8, 2013 Yeah ! That's what I like ! @ignace Yes, because this thread really needs yet another way of doing the same thing I totally agree with that ! But, where is the modulo(%) ? It's a school exercice with this 3 following Tip 1: Do not panic - Tip 2: Mostly good solutions also get points - Tip 3: Use modulo (%) @haku I believe Barand has posted the best non-regex solution in his first response Exactly ! Why ? Because I repeat 'Im not a regex expert', so this is the best that I can ! I know PHP, OOP, Design-Patterns and Zend but sure I need some regex lessons ! When you see a little regex like this preg_match('%[A-Z]%', $k) you think it's hard to understand ? @Chritian F So, since RegExp is "totally inappropriate" to give someone who's learning, you decided to provide the OP with not only one regular expression, but three(!). I'm open on every critize ! I's good for me ! But you can not to stay behind your screen with a donuts and coffee and just provide a little critic ! Show to us the best that you can do ! Also, if you can't deal with someone pointing out an error in your code. If I'm doing something wrong you must to tell me as soon as is possible not when it's too late ! and one of them even failing to work properly This is the best answer! @Psycho The best solution I can think of would be the use of a regular expression, which I am sure is way beyond your capabilities. And, I am kinda confused by the tip to use modulo.I can't really think of a solution that would use that. There are a few other solutions I can think of to accomplish this, but not knowing what you do and do not know I'm not sure what to suggest. But, one would be to use explode() to convert the string into an array, then verify the contents of each element of the array. But, I don't want to give too much Now, for me, the best solution is not The Best Solution ! If you say "Hey Selena the best solution it's to use the PHP preg_math() function with a complex regex in a single line", you must to tell her "But I know you are a beginner and for the same result I provide you a second way but with some basics PHP functions because it's more easy for you to progress step by step". Link to comment https://forums.phpfreaks.com/topic/272746-car-license-validation-help/page/2/#findComment-1404181 Share on other sites More sharing options...
Christian F. Posted January 8, 2013 Share Posted January 8, 2013 us2rn4m2: Are you just trolling, or are you seriously incapable of understanding what people write to you? You did not use the modulus operator either, and in either case it's a red herring for this case using PHP. I've posted the likely explanation for why the tutor may have thought that the use of modulus would be required here. Yours is not a "non-regexp" solution, because you've used Regular Expressions in all of your snippets. Not only that, you were the first person to post code containing RegExps. Yet you criticize others for suggesting RegExps, which actually work. While you may claim to know PHP, OOP and design patterns, your code tells a different story. Especially your second attempt. It bears all the hallmarks of programming by coincidence, which I (and a lot of others) would not classify as programming at all. I don't know how many ways I can tell you this: I've already posted my solution to this. Two versions of it, in fact. If you fail to realize this, then that is not my responsibility. Others clearly have seen, and understood, my solution and found it satisfactory. I told you exactly what was wrong, and why it was wrong, in my first reply after you posted it. You even quoted me on it. Lastly: If you can't be bothered to actually read what I'm writing to you, instead of just skimming my post and jumping to conclusions, then why should I be bothered to waste my time writing? This charade has gone on for long enough, and I won't be party to any further hijacking of Selena's thread. If she, or someone else, has a question about the solution I provided then I'll answer reply on that. Otherwise consider this my last reply in this thread, and to you in general. Link to comment https://forums.phpfreaks.com/topic/272746-car-license-validation-help/page/2/#findComment-1404191 Share on other sites More sharing options...
us2rn4m2 Posted January 8, 2013 Share Posted January 8, 2013 I'm not a troller. It was just interresting for me to defends my opinion because I don't forget when I start (alone wihout a teacher) to learn PHP. And before to 'close my mouth', 'No !' I'm not a lier I know Zend: http://forums.zend.c...hp?f=69&t=77938 http://forums.zend.c...p?f=69&t=104538 http://forums.zend.c...hp?f=69&t=72553 Link to comment https://forums.phpfreaks.com/topic/272746-car-license-validation-help/page/2/#findComment-1404217 Share on other sites More sharing options...
KevinM1 Posted January 8, 2013 Share Posted January 8, 2013 1. There's obviously a language barrier issue here. 2. @us2rn4m2, this isn't a contest. One person asked for help, several (including you) provided possible solutions. The question itself was not a matter of "Find the best/most efficient way to solve the problem" but rather to simply attempt to solve it. Remember: the question was given in the context of a web design course. Because the topic has seemingly run its course, I'm going to lock it. The OP can either send me a private message to re-open it, or simply make a new topic. Link to comment https://forums.phpfreaks.com/topic/272746-car-license-validation-help/page/2/#findComment-1404220 Share on other sites More sharing options...
Recommended Posts