PHP data types

2 posts / 0 new
Last post
Tom Owad's picture
Offline
Last seen: 18 hours 16 min ago
Joined: Dec 16 2003 - 15:14
Posts: 3356
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: 18 hours 16 min ago
Joined: Dec 16 2003 - 15:14
Posts: 3356
Resolved

Resolved.

Log in or register to post comments