<?php
chmod("/your_dir/your_file", 0600);
// Read and write for owner, nothing for everybody else
chmod("/your_dir/your_file", 0644);
// Read and write for owner, read for everybody else
chmod("/your_dir/your_file", 0755);
// Everything for owner, read and execute for others
chmod("/your_dir/your_file", 0750);
// Everything for owner, read and execute for owner's group
?>
Tag Archives: PHP
Remove the first and last item of the array – PHP
<?php
$sampleData = array('10', '20', '30.30', '40', '50');
array_shift($sampleData);
array_pop($sampleData);
print_r($sampleData); // Array ( [0] => 20 [1] => 30.30 [2] => 40 )
?>
Remove the first element of an array – PHP
<?php
$sampleDate = array("Test1", "Test2", "Test3", "Test4");
array_shift($sampleDate);
print_r($sampleDate); // Array ( [0] => Test2 [1] => Test3 [2] => Test4 ) .
// Test1 will be shifted
?>
Remove the last element of an array – PHP
<?php
$sampleDate = array("Test1", "Test2", "Test3", "Test4");
array_pop($sampleDate);
print_r($sampleDate); // Array ( [0] => Test1 [1] => Test2 [2] => Test3 ) .
// Test4 will be removed
?>
Replace string with another string – PHP
<?php
$name = "Hello Name";
$name =str_replace("Name", "First Name", $name);
echo $name; // Hello First Name
?>
Convert the first character of each word in a string into uppercase – PHP
<?php
echo ucwords("hello name"); // Hello Name
?>
Convert the first letter into lower case – PHP
<?php
echo lcfirst("Name"); // name
?>
Convert the first letter into uppercase – PHP
<?php
echo ucfirst("name"); //Name
?>
Convert the string into upper case – PHP
<?php
echo strtoupper("name"); // Name
?>
Convert the string into lower case – PHP
<?php
echo strtolower("FIRST NAME") //first name
?>