Need Help

Hey

Can any one help me how to convert this code to yii

this is my perl code

$a = 4342344442;

my $test ;

if($a =~ /(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)/){

$test = "$10.$9.$8.$7.$6.$5.$4.$3.$2.$1.1.p";

return $test ;

}

I am not familiar with PERL, but i guess it is a regular expression?




$t = $this->test;

if (preg_match($t, "/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)/", $m))

    $a = "{$m[10]}.{$m[9]}.{$m[8]}.{$m[7]}.{$m[6]}.{$m[5]}.{$m[4]}.{$m[3]}.{$m[2]}.{$m[1]}.1.p";

return $a;



Looks a little weird… :)

I got this error

preg_match() [<a href=‘function.preg-match’>function.preg-match</a>]: Delimiter must not be alphanumeric or backslash

Damn, always mixing up functions’ arguments in PHP :)

The first argument should be a regular expression.

I don’t understand. Can you tell me which one.

$t = $this->test;

if (preg_match($t, "/\(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)/", $m))

&#036;a = &quot;{&#036;m[10]}.{&#036;m[9]}.{&#036;m[8]}.{&#036;m[7]}.{&#036;m[6]}.{&#036;m[5]}.{&#036;m[4]}.{&#036;m[3]}.{&#036;m[2]}.{&#036;m[1]}.1.p&quot;;

return $a;

this is not working

got this error

preg_match() [<a href=‘function.preg-match’>function.preg-match</a>]: Delimiter must not be alphanumeric or backslash




$t = $this->test;

if (preg_match("/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)/", $t, $m))

    $a = "{$m[10]}.{$m[9]}.{$m[8]}.{$m[7]}.{$m[6]}.{$m[5]}.{$m[4]}.{$m[3]}.{$m[2]}.{$m[1]}.1.p";

return $a;



Still no luck

if (preg_match("/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)/", $t, $m)) {

syntax error

Multiple annotation found at this line :(

I don’t know if this code is exactly what you need, but it works for me. I am not sure I’ve seen the “Multiple annotation found at this line” error before :huh: