You're probably looking at gross abuse of the ternary operator.
Here's what I think the more normal form should be:
if ($this->k < 4) {
if ($this->k < 3) {
if ($this->k < 2) {
if ($this->k < 1) {
$this->s = Null;
} else {
$this->s = imagecreatefromgif($this->a);
}
} else {
$this->s = imagecreatefromjpeg($this->a);
}
} else {
$this->s = imagecreatefrompng($this->a);
}
} else {
$this->s = Null;
}
Here is a simple version that uses the information given "k type of the image, k = 1 is gif, k=2 is jpg, k=3 is png"
switch ($this->k) {
case 1:
$this->s = imagecreatefromgif($this->a);
break;
case 2:
$this->s = imagecreatefromjpeg($this->a);
break;
case 3:
$this->s = imagecreatefrompng($this->a);
break;
default:
$this->s = Null;
}