Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 1st, 2006, 2:31 AM   #1
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Token Problem... sorta

I've created a function called parsePost() here it is:[PHP]function parsePost($input){
$modify = $input;
$tokens = array();
while(false !== $openLocate = strpos($modify, chr(60))){
if(count($tokens) == 0){
array_push($tokens, substr($modify, 0, $openLocate));
} else {
array_push($tokens, chr(60) . substr($modify, 0, $openLocate));
if(false !== $closeLocate = strpos($tokens[count($tokens) - 1], chr(62))){
$temp = array_pop($tokens);
array_push($tokens, substr($temp, 0, $closeLocate + 1));
array_push($tokens, substr($temp, $closeLocate + 1));
}
}
$modify = substr($modify, $openLocate + 1);
}
if(count($tokens) == 0){
array_push($tokens, $modify);
} else {
array_push($tokens, chr(60) . $modify);
if(false !== $closeLocate = strpos($tokens[count($tokens) - 1], chr(62))){
$temp = array_pop($tokens);
array_push($tokens, substr($temp, 0, $closeLocate + 1));
array_push($tokens, substr($temp, $closeLocate + 1));
}
}
$temp = array();
for($i = 0; $i < count($tokens); $i++){
if(strlen($tokens[$i]) != 0){
array_push($temp, $tokens[$i]);
}
}
$tokens = $temp;
for($i = 0; $i < count($tokens); $i++){
$openLocate = strpos($tokens[$i], chr(60));
$closeLocate = strpos($tokens[$i], chr(62));
if($openLocate === 0 && $closeLocate === strlen($tokens[$i]) - 1){

} else {
$tokens[$i] == htmlentities($tokens[$i]);
}
}
return $tokens;
}[/PHP]It returns then input tokenized in the manner that I want, the problem is that for some reason it won't do the conversion of htmlentities as specified, can anyone tell me what's amiss here?
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck with a C problem Polaris C++ 8 Aug 19th, 2006 4:30 PM
output - 842150451? programmingnoob C++ 3 Apr 23rd, 2006 9:23 PM
writing a scanner (lexical analysis) programmingnoob C++ 6 Mar 19th, 2006 5:12 PM
cgi/perl script + IE problem joyceshee Perl 2 Jan 24th, 2006 12:10 PM
Pointers! Why? LOI Kratong C++ 33 Dec 18th, 2005 12:33 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC