Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2006, 07:15 PM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to change a CONSTANT defined in a class file?

Hi, I have the folowing php question:
I have 3 files:

the file a.php wich includes this php class: [ include "b.php"; ] (and more code...)
the file b.php wich includes this other php class: [ require_once("c.php"); ] (and other functions of course...)
and the file c.php wich has this definition: [ define('MAX_CUPS', 148); ] (and other definitions...)

My question is how can I overwrite the defined "MAX_CUPS" value for instance if I need sometimes 148, sometimes 400, sometimes 800, etc.
How cai I set this "MAX_CUPS" value again from the a.php file without having to edit the c.php file?
I read that "A constant's value cannot be changed after it is set", but im triying to get help with this issue...

Thanks indvance.

Aldo.
 
Old June 14th, 2006, 11:49 AM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is a typical sample of code in a.php, so as you can see there are nothing to edit or there are no variables to redefine, because i dont know where in the b.php its calling the 'MAX_CUPS' defined in the c.php
and i cannot edit the b.php and c.php because they are zend optimized.
a question, zend is only a ctypter or it optimizes the runtime too?

Code:
<?php
include "b.php";
$cups = new cupsCreator();
$cups->cupsSpec('MyCup1',0,0,120);
$cups->cupsParse();
?>
Aldo






Similar Threads
Thread Thread Starter Forum Replies Last Post
Class not defined? benatkin Classic ASP Basics 0 May 17th, 2007 12:49 PM
Make sure the class defined in this file matches . Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 20th, 2006 07:19 PM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
CS1595 : 'Class' is defined in multiple places dikkjo VS.NET 2002/2003 2 June 14th, 2003 04:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.