The Little Guy Posted September 4, 2007 Share Posted September 4, 2007 Warning: preg_replace() [function.preg-replace]: No ending delimiter '~' found in /home/.marble/ryannaddy/iconnect.publicsize.com/functions.php on line 17 Can someone help me find the ending delimiter please??? <?php $txtArr = array( '~a~','~b~','~c~','~d~','~e~','~f~','~g~','~h~','~i~','~j~','~k~','~l~','~m~','~n~','~o~','~p~','~q~','~r~','~s~','~t~','~u~','~v~','~w~','~x~','~y~','~z~', '~A~','~B~','~C~','~D~','~E~','~F~','~G~','~H~','~I~','~J~','~K~','~L~','~M~','~N~','~O~','~P~','~Q~','~R~','~S~','~T~','~U~','~V~','~W~','~X~','~Y~','~Z~', '~1~','~2~','~3~','~4~','~5~','~6~','~7~','~8~','~9~','~0~', '~\`~','~\~~','~\!~','~\@~','~\#~','~\$~','~\%~','~\^~','~\&~','~\*~','~\(~','~\)~','~\-~','~\_~','~\=~','~\+~','~\[~','~\]~','~\\~','~\{~','~\}~','~\|~','~\;~','~\'~','~\:~','~\"~','~\,~','~\.~','~\/~','~\<~','~\>~','~\?~','~ ~' ); ?> Quote Link to comment Share on other sites More sharing options...
d22552000 Posted September 4, 2007 Share Posted September 4, 2007 lol ALL THE ~ KEYS. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 5, 2007 Author Share Posted September 5, 2007 anyone? Quote Link to comment Share on other sites More sharing options...
sasa Posted September 5, 2007 Share Posted September 5, 2007 change '~\\~' to '~\\\~' Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 5, 2007 Author Share Posted September 5, 2007 will that only make it so when it searches the string, it only finds 1 \ it will work?? preg_replace("~\\\~","12","This contains \ right there"); so it should replace that single \ with 12... Is that correct? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 You know, you could have saved yourself a lot of ~ typing Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 5, 2007 Author Share Posted September 5, 2007 You know, you could have saved yourself a lot of ~ typing how? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 Post the code that uses this array and I'll show you. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 5, 2007 Author Share Posted September 5, 2007 <?php $encodeTxtArr = array( '~a~','~b~','~c~','~d~','~e~','~f~','~g~','~h~','~i~','~j~','~k~','~l~','~m~','~n~','~o~','~p~','~q~','~r~','~s~','~t~','~u~','~v~','~w~','~x~','~y~','~z~', '~A~','~B~','~C~','~D~','~E~','~F~','~G~','~H~','~I~','~J~','~K~','~L~','~M~','~N~','~O~','~P~','~Q~','~R~','~S~','~T~','~U~','~V~','~W~','~X~','~Y~','~Z~', '~1~','~2~','~3~','~4~','~5~','~6~','~7~','~8~','~9~','~0~', '~\`~','~\~~','~\!~','~\@~','~\#~','~\$~','~\%~','~\^~','~\&~','~\*~','~\(~','~\)~','~\-~','~\_~','~\=~','~\+~','~\[~','~\]~','~\\~','~\{~','~\}~','~\|~','~\;~','~\'~','~\:~','~\"~','~\,~','~\.~','~\/~','~\<~','~\>~','~\?~','~ ~' ); $encodeNumArr = array( '31','58','17','93','40','74','50','28','60','87','63','59','26','66','15','10','20', '37','25','35','53','56','12','65','57','43','27','61','19','23','69','68','83','47', '06','09','81','73','29','44','55','79','92','39','62','01','90','76','95','34','42', '49','46','24','78','13','21','05','94','84','07','03','82','75','77','41','70','88', '54','02','85','38','14','08','71','18','64','45','04','89','11','51','80','86','30', '48','32','36','52','16','22','33','00','67','72'); function encode($str){ global $encodeTxtArr,$encodeNumArr; $str = str_split($str); $st = ''; foreach($str as $val){ $st .= preg_replace($encodeTxtArr,$encodeNumArr,$val); } return $st; } ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 If you'd left them out of all the array elements, you can add them in with a foreach. Also, using range() you could have skipped writing all of the letters individually. <?php foreach($encodeTxtArr AS $k=>$v){ $encodeTxtArr[$k] = '~'.$v.'~'; } ?> It's a bit late now, but it was just a point Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.