Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente bannato
    Registrato dal
    Jun 2012
    Messaggi
    73

    Sostituire le "..........." virgolette

    $string = 'The quick brown fox "jumped" over the lazy dog.';

    Come faccio a cambiare le virgolette con le freccette?

    The quick brown fox "jumped" over the lazy dog.
    The quick brown fox «jumped» over the lazy dog.

    » »
    « «

    $patterns = '';
    $replacements = '';
    preg_replace($patterns, $replacements, $string);

    Come si potrebbe implementare?

  2. #2
    cosi:
    Codice PHP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Untitled 1</title>
    </head>
    <body>
    <?php
    $string 
    'The quick brown fox "jumped" over the lazy dog.';
    echo 
    $string.'
    '
    ;
    $string str_replace(' "'' «'$string);
    $string str_replace('" ''» '$string);
    echo 
    $string.'
    '
    ;
    ?>
    </body>
    </html>
    solo assicurati che il file sia codificato utf-8 altrimenti ti visualizza male i caratteri

  3. #3
    Utente bannato
    Registrato dal
    Jun 2012
    Messaggi
    73
    grazie!

  4. #4

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.