DIGIT-ARC read-only archive · snapshot: July 23, 2026

How to write php variable as string

1 post · originally from https://geek.digit.in/community/threads/how-to-write-php-variable-as-string.136673/

G
ganesh_dabhade Original post #1
Feb 6, 2011 at 6:43 PM
I want to create one folder using php codebehind, say 'newfolder' and also want to create a file called 'index.php' which should contain the code I specified below.

<?php
$curdir = basename(dirname(__FILE__));
require_once '../template/index.php';
?>

But the problem is when I create the file index.php using php code, it writes as follows.

<?php
= basename(dirname(__FILE__));
require_once '../template/index.php';
?>

the variable gets eliminated.
Please help me solve this problem.