Jump to content
Larry Ullman's Book Forums

erikvail

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by erikvail

  1. Though my prev. post targets python it can be true for ruby also.
  2. I would recommend reading the following article of Alan Storm regarding the difference between Php and Python Some of the these aproach problems were overcome by introducing the namespace concept in php. These differences are due to the development of the PHP language which was not a designed from start but evolved naturaly. An example with namespaces in php showing how we can solve nowadays these fine pecularities <?php namespace Earth; #File: hello_earth.php function hello() { echo "Hello Earth! \n"; } hello(); ?> <?php namespace Mars; #File: hello_mars.php function hello() { echo "Hello Mars! Mind the germs. \n"; } hello(); ?> <?php namespace Solar; include 'hello_earth.php'; include 'hello_mars.php'; echo "Starting up a solar system \n"; /* Usage with use use Earth; use Mars; Earth\hello(); Mars\hello(); */ \Earth\hello(); \Mars\hello(); ?>
×
×
  • Create New...