So in php $a = 1234;
and $a = (1234);
are both valid integers, 1234.
I have a situation with some third party code where I have $a = "(1234)";
(ie, a string)
The normal converting string to int don't work (because of the brackets)
<?php
$b = (int) $a; // 0
$b = intval($a); // 0
I could do something like
preg_match('/^\(([\d]+)\)$/', $a, $m);
$b = $m[1];
Just wondering if there there some clever way of converting $a back into an integer that I have missed?