Sorry if this is hard to read. Due to Internet issues I am unable to connect from my desktop until my provider gets off their butt to fix their end. I am writing this from my iPhone.
Okay, so, I have a class I am defining and I need two constructs. In one construct, I am passing an integer to the construct. In the other, I am passing a string. The issue is how I define these as the constructs look the same:
function __construct($someInt){
// code goes here
}
function __construct($someStr){
// code goes here
}
If I create an object attempting to pass an integer, how does the compiler know which construct to use? It seem I can’t typecast by declaring the types in the constructs (in other words I can’t say function __construct((string)$someString) as it throws an error. How do I create two different constructs with the same number of variables being passed to it?