Cannibal_Monkey Posted December 11, 2006 Share Posted December 11, 2006 Okay, I was reading a PHP book and I am up to Matching Strings to Patterns, and I have things, like C$ which is supposed to check if the last letter in a string is a C. So how do I use this? I tried putting it in the if () thing but that didn't work. So where do I put it? Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/ Share on other sites More sharing options...
trq Posted December 11, 2006 Share Posted December 11, 2006 What? You'll need to post some code or something, your post makes no sense. C$ is nothing in php. Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/#findComment-138702 Share on other sites More sharing options...
Cannibal_Monkey Posted December 11, 2006 Author Share Posted December 11, 2006 The c$ is supposed to be plugged into something to determine if a string ends in c. I don't know what to plug it into. Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/#findComment-138704 Share on other sites More sharing options...
trq Posted December 11, 2006 Share Posted December 11, 2006 Ah... I think your talking about regular expressions. Take a look at [url=http://php.net/preg_match]preg_match[/url]() and related functions.Surely your book also describes [i]how[/i] to use patterns. Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/#findComment-138705 Share on other sites More sharing options...
Cannibal_Monkey Posted December 11, 2006 Author Share Posted December 11, 2006 No it hadn't said anything about that. I guess they forgot that part? Thanks :) Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/#findComment-138707 Share on other sites More sharing options...
doni49 Posted December 11, 2006 Share Posted December 11, 2006 Check the last char of a string for a specific letter:[code]<?php$c = "This is a Test";if (substr(strtolower($c), -1)==(strtolower("t")){ echo "C ended in t";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/30172-what-do-i-do-with-this/#findComment-138711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.