Welcome visitor
* Login
* Register
It is currently May 22nd, 2019, 2:46 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  strripos issue
PostPosted: April 2nd, 2009, 10:14 pm 

Posts: 57
hi, im using strripos but it works the other way around than what i'd thought.
im using it combined with substr and they actually work but not as i thought.

on the string "one two three" instead of chop it like "one"-"two"-"three" it does "one two"-"two"-"three".

heres the code
<?php
$s="one two three";
$t=substr_count($s," ");
$i=1;                   
while ($i<=$t+1){
    $fp=strripos($s," ");               
    if ($fp<=0){$fp=strlen($s);}
    $result[$i]=substr($s,0,$fp);   
    $s=strchr($s," ");
    $s=trim($s);
    $i++;}
print_r ($result);
?>

the reult is pretty similar than what i need, so the error should be a small one i think. thanks in advanced for the help.


Top
 Profile  
 
  Re: strripos issue
PostPosted: April 2nd, 2009, 10:16 pm 

Posts: 96
See if "stripos" and not "strripos" does the work. ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron