Jump to content

Why one backslash is changed into two?


a123123

Recommended Posts

I have problem with this code:

<?php
$patterns = array('/(?<=\s)(\s|,|\+|frac|cdot|begin|cases|end|\^|\(|\)|\[|\]|\{|\}|\d|\-|\=|(?<=\+|\-|\=)(a|e|i|o|u|y)|b|c|d|f|g|h|j|k|l|m|n|p|r|s|t(?!ex)|(?<!te)x|B|C|D|F|G|H|J|K|L|M|N|P|R|S|T|X|.\(.\)|^\[t\]|^\[\/t\])+(?=(\s|,|\.|\?|\!|\(??!\[\/tex\]).|\n)*\[t\])/');
$replacements = array('($1)');
$string=$_POST['kod'];
echo preg_replace($patterns, $replacements, $string);
?>

Why it changes one backslash: \ into two: \\?

Thanks for answer.

Link to comment
https://forums.phpfreaks.com/topic/264587-why-one-backslash-is-changed-into-two/
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.