PHP data types

2 posts / 0 new
Last post
Tom Owad's picture
Offline
Last seen: 2 days 14 hours ago
Joined: Dec 16 2003 - 15:14
Posts: 3385
PHP data types

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.

Tom Owad's picture
Offline
Last seen: 2 days 14 hours ago
Joined: Dec 16 2003 - 15:14
Posts: 3385
Resolved

Resolved.

Log in or register to post comments