Hey.

<div class="name"> <?$deli = chr(34); $item = explode($deli, $arItem["NAME"])?> <a href="<?=$arItem['DETAIL_PAGE_URL']?>"><?print_r($item)?></a> </div> 

The name, for example, is Something "Something in Double Quotes". Does not break and that's all.

  • What needs to be divided is incomprehensible. What text is contained in the $arItem["NAME"] variable? What is the symbol chr(34) and why should it be written through the function chr() ? PS:> What is that "What is that? It is right to write" Что-то "Что-то " - Opalosolo
  • $ arItem ["NAme"] for example = Nightdress "Vologda". Why through chr, because it does not accept explode ("" ", $ arItem [" NAme "]). I need to separate the text in" "from the line. I tried regular rewriting, heaped up more heresy. - Roman20
  • @ Roman20, in order to use quotation marks in a string, you must either take the string in other quotes (strings can be written both in apostrophes / single quotes, and in ordinary double quotes), or you can escape the quotation mark with a backslash. 'abcd "dbca' ===" abcd \ "dbca" - etki

2 answers 2

Brad your regulars, there is a very convenient method of split.

 Пример #2 Пример использования split() 

Recognize a date formatted with slashes, periods, or hyphens:

 <?php // Разделителями могут быть слеши, точки или дефисы $date = "04/30/1973"; list($month, $day, $year) = split('[/.-]', $date); echo "Месяц: $month; День: $day; Год: $year<br />\n"; ?> 

Here is a reference with examples, I think, you will understand.

  • one
    > Nonsense are your regulars @djbolya, but isn't your first parameter in split () a regular? )) - Deonis

@ Roman20 - Did you try to put a double quote in single, well, or escape?

In general, explode is not the best solution here, I would recommend using regular expressions.

Ideone.com