BLHTML.org

BLHTML.org / Web Programming / BLHTML / BLHTML Manual / BLHTML Introduction / BLHTML syntax /

 
  Array handling 1372 0
BLHTML is only capable of one dimensions arrays!
Array can then be sent by the html form.

#$a[key]=value# // Declare $a[key] to value

#$a[*](10=red 20(light grey) color blue)# // Declare key=value, key=value...

$a[10]=#$a[10]#<br>
$a[20](#$a[20]#)<br>
$a[color]=#$a[color]#<br><br>


#$a[+](10=red 20(light grey) color blue)# // Declare key: 0, 1, 2...

#$a[key]#

$a[0]=#$a[0]#<br>
$a[1]=#$a[1]#<br>
$a[2]=#$a[2]#<br>
$a[3](#$a[3]#)<br>
$a[4]=#$a[4]#<br>
$a[5]=#$a[5]#

Returns:
$a[10]=red
$a[20](light grey)
$a[color]=blue

$a[0]=10
$a[1]=red
$a[2]=20
$a[3](light grey)
$a[4]=color
$a[5]=blue

Dynamic arrays:
#$id=8#
#$arr=0#

#SUM value(81$id) null=true return(ant_$id[$arr])#
// Function return array
#$ant_$id[$arr](81$id)# // Declare variable

$ant_#$id#[$arr]=#$ant_$id[$arr]#

Returns:
$ant_8=818

Example of dynamic arrays handling:
#$ok=8#
#$a[$ok]$ok#

1. $a[8] = #$a[$a[$ok]]#<br>
2. $a[8] = #DATA[a[$a[$a[$a[$a[$a[$a[$a[$a[$a[$a[$a[$a[$a[$ok]]]]]]]]]]]]]]]#<br>

#$a[$a[$a[$a[$a[$a[$a[$a[$a[$ok]]]]]]]]](New values)#
3. $a[8] = "#$a[$ok]#"<br>

#$b=7#
#$c=9#
#$a[$b$c]=38#

#$str[$a[$b$c]](is $ok an nice string?)#
$str[38] = "#$str[$a[$b$c]]#"

Returns:
1. $a[8] = 8
2. $a[8] = 8
3. $a[8] = "New values"
$str[38] = "is 8 an nice string?"

More information:
  • Variable handling
  • array
  • #ARRAY#
  • Dynamic variables
  • BLHTML forum  


    apache MySQL PHP No to software patents! BLHTML
    © 2003, 2010 BLHTML
    This page is created with BLHTML in 0.0644 seconds