How to remove spaces and beginning 0 from a contact number in Views PHP view?
You can do it using the PHP function str_replace 

$number = $row-&gt;field_contact_number;
// Remove the spaces.
$number = str_replace(' ', '', $number);
// Grab the first number. 
$first_number = substr($number, 0, 1); 
if ($first_number == 0) {
  // Check if the first number is 0.
  // Get rid of the first number.
  $number = substr($number, 1, 999); 
}
// Remove the + sign.
$number = str_replace('+', '', $number);
echo $number;




Although the question asked using Views PHP, it is not a good idea to enable the Views PHP and PHP Filter module. In Drupal 7, the alternative/preferred method would be to add the following code to the bottom of your template.php file (located in /sites/all/themes/yourtheme/ folder).

function themename_preprocess_views_view_fields($vars){
  if ($vars['view']-&gt;name == "view_name" &amp;&amp; $vars['view']-&gt;current_display == "block_1") {
    $number = $vars['fields']['field_contact_number']-&gt;content;
    // Remove the spaces.
    $number = str_replace(' ', '', $number);
    // Grab the first number. 
    $first_number = substr($number, 0, 1);
    if ($first_number == 0) {
      // Check if the first number is 0.
      // Get rid of the first number.
      $number = substr($number, 1, 999);
    }
    // Remove the + sign.
    $number = str_replace('+', '', $number);
    $vars['fields']['field_contact_number']-&gt;content = $number;
  }
}



Replace themename with your theme name
Replace view_name with your view name
Replace block_1 with your machine name


Remember to flush the cache to see the changes.