<?php
echo rtrim("Test "); // Test
//Will remove the spaces from the end
?>
Tag Archives: PHP
Remove spaces from the beginning of a string – PHP
<?php
echo ltrim(" Test"); // Test
//Will remove the spaces from the beginning
?>
How to find out the number of posts added to a given category – WordPress
<?php
$posts = get_posts(array('category' => 5)); // Here 5 is category id
echo sizeof($posts);
?>
WordPress function to fetch posts from category id
<?php
$posts = get_posts(array('category' => 5)); // Here 5 is category id
?>
Command to install PHP – Ubuntu Linux
sudo apt-get install php5
Load tinymce editor on client side – Joomla
<?php $editor =& JFactory::getEditor(); echo $editor->display( 'story', $story , '600', '300', '5', '2' ); ?>
How to get prefix of tables in Joomla site
<?php $dVar=new JConfig(); echo $dVar->dbprefix //jos_ ?>
How to check whether the user is logged in or not – Joomla
<?php
$user = & JFactory::getUser();
if($user_id=$user_id=$user->get('id'))
echo "Logged in user"
?>
Find out the user id of the logged in user – Joomla
<?php
$user = & JFactory::getUser();
echo $user_id=$user_id=$user->get('id');
?>
How to decode the data – PHP
<?php
$enData =base64_encode("First");
echo base64_decode($enData);//First
?>