PHP - Moved: How Would I Check For Html Or Web Addresses In A Text String?
This topic has been moved to PHP Regex.
http://www.phpfreaks.com/forums/index.php?topic=327134.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342245.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=331164.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=326004.0 Hello, I'm working on an error form, and I want to check if the user inserted a number into the name field, and if so return an error. I thought this might of worked, but it doesn't: Code: [Select] if(is_int($_POST['name'])){ $arrErrors['name'] = 'Invalid name, remove numbers.'; } Many thanks How do you find out how many character within a String ?? for example: $temp = "apple"; I want to return "5" for $temp as it has 5 characters. Thanks! Hi, How can i check if a string is a multiple of 0.1 without anything being left over? like 1.6 = true, 1.46 = false Hey, I have an if statement that requires to check a $_POST to make sure its an integer not a string but cant remember how to do this. Anyone able to assits Thanks How can i check if a string is URL encoded or not using PHP I have an array of $fl By using values of this array, i want to create a new string. I need string size will be maximum 200 characters. When i try below code snipped, $f value is added to string two times. How can i add $f to array only one time, with checking size of string. Thank you Code: [Select] $fl=getsomelist(); // gives an array $userList=''; foreach ($fl as $f) { if ( strlen($userList .= $f) <= (200) ) { $userList .= $f; } else { break; } } I want to allow Alphabetical strings, Numeric strings, and Alphanumeric strings. For example "Bob", "1234", "bob1234" are all valid. I want to check if the string has invalid characters, return true if it does (or false, which ever method works). How can I do it? Hey. I been using a function to check if a string contains only letters which is: ctype_alpha But i would like to change it to allow numbers 0 to 9 and the letters is there a function to do that in PHP i can't find it. I was wondering if anyone knows a good way to check for an even number of each character in a string. For example if the string is "abbacc" then it will return true as there are two of each character. However if the string is "ababc" it will return false as there is only 1 c. Thanks for any help Hi all, i've got a string ($currentcatid) which contains one number which changes dependant on which page the visitor is on.. ie it may be perhaps "23" or "17" . I need to do a check against this string to see if it contains any of the following values .. 31,32, 1, 24 . I cant remember how i did it before but i think it was with pipes.. something along the lines of if ($currentcatid =="31"||"32"||"1"||"24") { action } can anyone help? Thanks I want to check if a string has any of words listed in array; Code: [Select] $array=array('word1', 'word2', 'word3'); $string="This is a sentence containing word2"; Now I want to make an 'if else' to check if the string contains any of the words listed in the array. Thanks Hello guys, I have a form where you can select a score between 0 and 10(only integers).
I want to check if the value that I recive, is integer.
Im using this code(exemple):
$integer = intval($_POST["p1"]); if(is_int($integer)){ echo 'INT'; } else { echo 'NO INT'; }My problem is that if it recive letters, the conversion converts it to 0, and it says that it is integer. So with this method I should discard the 0. You guys know a method to avoid that? Thank you guys I have a web server which contains a public site and a private site. I want to be able to test for public or private using the page title and return the appropriate header which contains a different banner, css etc. Firstly - the syntax below seems to be incorrect because it doesnt work correctly. More importantly how do I add all the values to an array and than iterate through it to check for a matching page title? Code: [Select] public function publicSite() { if ($this->getTitle()== 'Home' || 'About Us'||'Registration' || 'Sitemap' || 'Contact Us' || 'Useful Links' || 'Feedback') { return true; } return false; } Then later on I would have: Code: [Select] if ($this->publicSite()) { require($ROOT.'interface/pages/publicheader.php'); } else { require($ROOT.'interface/pages/privateheader.php'); } Thanks heaps! This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=318750.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320394.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347295.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317810.0 |