1

I need to create a web app for a school project and need to use SVN. I have a path in a PHP variable and iam using command line svn. So i need to pass that variable into batch file command. So how can I store the value of PHP variable into the batch variable. please help.

My code

<?PHP
$vname="\project";
$svnpath="d:\a\svn";
$serverpath=$svnpath.$vname;
mkdir $serverpath;
exec("svnadmin create <server path value>");
?>
2
  • See the answer here.If you still can't get it leave a comment. Commented Jul 17, 2017 at 9:25
  • 4
    Possible duplicate of Passing variable throght PHP exec Commented Jul 17, 2017 at 10:58

1 Answer 1

1

You can simply use exec("svnadmin create $serverpath"). Interpreter will replace $serverpath with it's value just like in normal strings wrapped with ".

For example:

echo 'svnadmin create $serverpath' will output svnadmin create $serverpath

However:

echo "svnadmin create $serverpath" will output svnadmin create d:\a\svn\project

More information in docs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.