PHP to 4GL/ABL

PHP to 4GL/ABL

Added Entry() and NumEntries() to PHP code for a string of comma delimited substrings like the ABL/4GL has. Also included a cout(), though that is more C++ oriented. Code below:


/* Simple print */

function cout($a) {
? print($a . "<br>");
}

/* Return an entry for a string starts with 1 */

function Entry($n, $l) {
? $n--;
? $v=explode(",", $l);
? return $v[$n];
}

/* Number of entries */

function NumEntries ($a) {

? $v=explode(",", $a);
? return count($v);
?
}


/* test */

$t="1,22,333";
cout($t);
cout(NumEntries($t));
cout(Entry(3,$t));        

Code results are:

Evaluating


1,22,333

3

333

Going to add more as I need 'em.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了