Tcl and PHP Calculator Tutorial

Tcl and PHP Calculator Tutorial

Tcl and PHP Calculator Tutorial

The Tcl and PHP Primer Tutorial was a foretaste to today’s calculator web application that …

  • uses PHP as a frontend and (HTML) form navigation destination …
  • connects to backend via PHP exec
  • uses TCL as backend … via …

    exec("tclsh calculator.tcl < calculator.txt | tail -1 > calculator.out");

Crucial to the TCL’s backend role is TCL’s expr command, as a determinant regarding what today’s calculator is capable of.

Here is a link to some downloadable PHP source code calculator.php supervising calculator.tcl TCL source code, and here is a live run link.


Previous relevant Tcl and PHP Primer Tutorial … //www.tcl.tk/software/tcltk/ is shown below.

Tcl and PHP Primer Tutorial ... //www.tcl.tk/software/tcltk/

Tcl and PHP Primer Tutorial ... //www.tcl.tk/software/tcltk/

Have you heard of Tcl/Tk? Think maybe you could introduce yourself to it with Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial as shown below.

The Tcl in Tcl/Tk refers to the scripting side of things, while the Tk is a GUI framework. On some (maybe lots) of Linux or unix web servers, such as the one for this domain here at www.rjmprogramming.com.au Tcl scripting is available and that means Tcl could be used by PHP, as a server side language to use the exec method to ask something of Tcl and get something back, half of which is the arrangement we’d like to have when feeding our babies.

Today we write a webpage for finding the Country of Origin of a designated URL where PHP supervises Tcl:

  1. ask for a URL in PHP,
  2. send that to the same PHP with a different call …
  3. and use PHP exec method to send a Tcl commend line command to Tclsh and output this to a file known by the PHP,
  4. get the PHP to read the file of step 3. and send that information in a modified call of this same PHP,
  5. write out the Tcl based findings to the webpage in PHP,
  6. ask for a URL in PHP

Here is a link to some downloadable PHP source code domain.php supervising domain.tcl TCL source code, and here is a live run link.

Thanks to:


Previous relevant Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial is shown below.

Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial ... //www.tcl.tk/software/tcltk/Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial ... //www.tcl.tk/software/tcltk/

Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial ... //www.tcl.tk/software/tcltk/

Have you heard of Tcl/Tk?

Tcl/Tk is open source (based on a BSD-style license), so you can use it and modify it virtually any way you want, including for commercial uses.

With Tcl/Tk have used in conjunction with C++ and Python (look out for Tkinter).

Use it for Games Programming (it makes pretty cute GUIs … you may disagree?!) and it used to work back at Mac OS X 10.5.8/XCode 3.0 (am going to try Mac OS X 10.7.5 … any advice anywhere?) and had it going on Windows XP with Visual Studio Express as well. It has a lot of cross-platform strengths.

Think Tcl/Tk is really really good.

In this primer tutorial you can see a Draw Poker game as an XCode project, see it Build and in action, then see how to arrange for *.dmg Package Distribution via Package Manager.

Link to Tcl/Tk website … Home of Tcl/Tk … where quote up the top resides
Link to Tcl/Tk jobs done … Tcl/Tk jobs done … personal experience

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Tutorials and tagged , , , , , , , , , , , . Bookmark the permalink.

One Response to Tcl and PHP Calculator Tutorial

  1. “It was a dreary day here yesterday, so I just took to messing around online and found”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>