-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphp.scala
More file actions
31 lines (28 loc) · 770 Bytes
/
php.scala
File metadata and controls
31 lines (28 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import scala.collection.immutable._;
object php{
def echo( value:Any * ) = {
value.foreach( print )
}
def array( values:Any * ):Map[Any, Any] = {
var result = Map[Any, Any]()
var maxIndex = -1
values.foreach( value => {
value match{
case v:(Any, Any) => {
result += (v._1 -> v._2)
v._1 match {
case index:Int => maxIndex = maxIndex max index
case _ =>
}
}
case _ => {
maxIndex = maxIndex + 1
result += (maxIndex -> value)
}
}
} )
return result
}
}
trait PHPObject{
}