[ create a new paste ] login | about

Link: http://codepad.org/2BU07kKJ    [ raw code | output | fork ]

PHP, pasted on Sep 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

define('PREFIX', '/holiday');
define('SUFFIX', '/work');
define('BLABLA', '/lorem');
define('ETC', '/ipsum');

$cname = 'constant'; // if you want to use a function in heredoc, you must save function name in variable

$body = <<<EOD
<img src="{$cname(PREFIX)}/images/hello.png" />
<img src="{$cname(SUFFIX)}/images/hello.png" />
<img src="{$cname(BLABLA)}/images/hello.png" />
<img src="{$cname(ETC)}/images/hello.png" />
EOD;


Output:
1
2
3
4
5
6
7
8

Warning: constant(): Couldn't find constant /holiday on line 11

Warning: constant(): Couldn't find constant /work on line 12

Warning: constant(): Couldn't find constant /lorem on line 13

Warning: constant(): Couldn't find constant /ipsum on line 14


Create a new paste based on this one


Comments: