PHP Mysql - 如何在每个数字后控制白色 space
PHP Mysql - How to control white space after every number
下面有这段代码,如果我想控制数字之间的间距,我该怎么做。
1 0 , 5 6 5 , 6 6 0 。 8 8 (currently 1 white space) - 这是当前输出,我想要更多
spaces 在每个数字之间可能有 3 个或更多的白色 space。提前谢谢你。
<?php session_start() ; ?>
<?php require "../db_connection304.php" ; ?>
<?php
require_once('../../bus_partners/fpdf/fpdf/fpdf.php');
require_once('../../bus_partners/fpdf/fpdi/fpdi.php');
$pdf = new FPDI();
if (isset($_POST["submit"])) {
$payroll_month = mysqli_real_escape_string($connection304, $_POST['payroll_month']);
}
$year = preg_split("/[-_ ]+/", $payroll_month) ;
$year = $year[1] ;
$payrolldate1 = str_replace('_','', $payroll_month) ;
$payroll_date2 = date_create_from_format("FjY","$payrolldate1") ;
$monthly_statutory = date_format($payroll_date2,"m") ;
$query = "SELECT SUM( GROSS_PAY ) AS gross_pay FROM ".$_SESSION['$company_code']."_".$year." WHERE MONTH(PAYROLL_PERIOD) = '{$monthly_statutory}' ";
$result_gross_pay = mysqli_query($connection304,$query) ;
while($row_gross_pay = mysqli_fetch_array($result_gross_pay)) {
$gross_pay = $row_gross_pay['gross_pay'] ;
}
$gross_pay = number_format($gross_pay,2 ) ;
$gross_pay_withspace = chunk_split($gross_pay,1,' ') ;
替换
chunk_split($gross_pay,1,' ') ;
和
chunk_split($gross_pay,1," ") ;
//no. of " " varies based on requirement
下面有这段代码,如果我想控制数字之间的间距,我该怎么做。 1 0 , 5 6 5 , 6 6 0 。 8 8 (currently 1 white space) - 这是当前输出,我想要更多 spaces 在每个数字之间可能有 3 个或更多的白色 space。提前谢谢你。
<?php session_start() ; ?>
<?php require "../db_connection304.php" ; ?>
<?php
require_once('../../bus_partners/fpdf/fpdf/fpdf.php');
require_once('../../bus_partners/fpdf/fpdi/fpdi.php');
$pdf = new FPDI();
if (isset($_POST["submit"])) {
$payroll_month = mysqli_real_escape_string($connection304, $_POST['payroll_month']);
}
$year = preg_split("/[-_ ]+/", $payroll_month) ;
$year = $year[1] ;
$payrolldate1 = str_replace('_','', $payroll_month) ;
$payroll_date2 = date_create_from_format("FjY","$payrolldate1") ;
$monthly_statutory = date_format($payroll_date2,"m") ;
$query = "SELECT SUM( GROSS_PAY ) AS gross_pay FROM ".$_SESSION['$company_code']."_".$year." WHERE MONTH(PAYROLL_PERIOD) = '{$monthly_statutory}' ";
$result_gross_pay = mysqli_query($connection304,$query) ;
while($row_gross_pay = mysqli_fetch_array($result_gross_pay)) {
$gross_pay = $row_gross_pay['gross_pay'] ;
}
$gross_pay = number_format($gross_pay,2 ) ;
$gross_pay_withspace = chunk_split($gross_pay,1,' ') ;
替换
chunk_split($gross_pay,1,' ') ;
和
chunk_split($gross_pay,1," ") ;
//no. of " " varies based on requirement