actionscript 3 - Port lastIndexOf AS3 code to PHP -


i'm trying port as3 code php finds tags (hashtags) @ end of text block. i'm stuck @ part lastindexof. how write in php?

as3:

var message = "lorem #ipsum dolor sit amet, consetetur #1tag #2tag #3tag" while (message.lastindexof(" ") == message.lastindexof(" #")){     message = message.slice(0,message.lastindexof(" ")); } 

i tried code got error: unexpected 'while' (t_while) php:

$message = "lorem #ipsum dolor sit amet, consetetur #1tag #2tag #3tag"; while (strrchr(" ",$message) == strrchr(" #",$message)){     $message = $message.substr(0,strrchr(" ",$message)); } 

add ; symbol @ end of next line:

$message = "lorem #ipsum dolor sit amet, consetetur #1tag #2tag #3tag" 

and swap arguments in strrchr functions.

strrchr(" ",$message) strrchr($message, " ") 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -