3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $order = "Pedido: [PEDIDO]\nNome: [NOME]\nValor: [VALOR]\nFrete: [FRETE]\n Desconto: [DESCONTO]\nTotal: [TOTAL]"; $replacements = array( '[PEDIDO]' => 123, '[NOME]' => 'Bruno Augusto', '[VALOR]' => 69.00, '[FRETE]' => 0, '[DESCONTO]' => 69.00, '[TOTAL]' => 'It\'s FREE!', ); echo preg_replace( array_map( 'preg_quote', array_keys( $replacements ) ), array_map( 'preg_quote', array_values( $replacements ) ), $order );
based on 65ZXk
Output for 5.2.5 - 5.6.28, 7.0.0 - 7.1.0
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14
Output for hhvm-3.10.0 - 3.12.0
Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14
Output for 4.3.11 - 5.2.4
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Pedido: [PEDIDO] Nome: [NOME] Valor: [VALOR] Frete: [FRETE] Desconto: [DESCONTO] Total: [TOTAL]
Output for 4.3.0 - 4.3.10
Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Warning: Delimiter must not be alphanumeric or backslash in /in/36e9d on line 14 Pedido: [PEDIDO] Nome: [NOME] Valor: [VALOR] Frete: [FRETE] Desconto: [DESCONTO] Total: [TOTAL]