Jump to content

ending delimiter


The Little Guy

Recommended Posts

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~',
'~\`~','~\~~','~\!~','~\@~','~\#~','~\$~','~\%~','~\^~','~\&~','~\*~','~\(~','~\)~','~\-~','~\_~','~\=~','~\+~','~\[~','~\]~','~\\~','~\{~','~\}~','~\|~','~\;~','~\'~','~\:~','~\"~','~\,~','~\.~','~\/~','~\<~','~\>~','~\?~','~ ~'
);
?>

Link to comment
https://forums.phpfreaks.com/topic/67960-ending-delimiter/
Share on other sites

<?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;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/67960-ending-delimiter/#findComment-342472
Share on other sites

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 :)

Link to comment
https://forums.phpfreaks.com/topic/67960-ending-delimiter/#findComment-342475
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.