Given the following code snippet:
$i= 11;
function get_num() {
global $i;
return (--$i >= 0) ? $i : false;
}
while($num = get_num()) {
echo "Number: $num\n";
}
Results in the following output:
Number: 10
Number: 9
Number: 8
Number: 7
Number: 6
Number: 5
Number: 4
Number: 3
Number: 2
Number: 1
However, I also w...
I'm trying to define a class (or set of classes which implement the same interface) that will behave as a loosely typed object (like JavaScript). They can hold any sort of data and operations on them depend on the underlying type.
I have it working in three different ways but none seem ideal. These test versions only allow strings and i...
Hi,
We're developing a layered web application. The specs:
3 layers, data layer, business layer,
ui layer.
Programmed in C#
Data Layer uses the entity framework
Currently we plan on having the data layer return IEnumerable<T> to the business layer via linq 2 entities, and the business layer will return data to the ui layer.
Sinc...
I have a small PHP web-based application that is beginning to grow moderately in size.
I'm starting to become concerned with managing my PHP code base, given PHP is a loosely/weak typed, dynamic language.
How do others manage their code based for loosely/weak typed, dynamic languages?
Do pre-parsers exist for PHP that allow me to runs...
I have a class called AddressCard from an example in "Programming in Objective C", and I'm implementing a isEqual: method.
The signature of this method in NSObject uses loose typing for the parameter:
- (BOOL)isEqual:(id)anObject
OTOH, the sample code in the book uses strict typing:
- (BOOL) isEqual:(AddressCard *) aCard
I'm not s...