PHP data types

1 reply [Last post]
Tom Owad's picture
Offline
Joined: Dec 16 2003
Posts: 2460

I use this line to parse "[ node:478 ]":

$preg = array(
...
'#\[node:(\d+)]#si' => nid_to_link('\\1'),
...
)

which calls this function:

function nid_to_link($nid) {
$output = "nid: $nid";
$output .= " intval: ";
$output .= intval($nid);
return $output;
}

The output is:

nid: 478 intval: 0

Anybody know why I am unable to cast nid to an int? I've tried various other methods including casting with (int), (integer), adding 0, etc. Any advice is most appreciated.

__________________

Admin

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Tom Owad's picture
Offline
Joined: Dec 16 2003
Posts: 2460
Resolved

Resolved.

__________________

Admin