Tag Archives: string

XML file using PHP SimpleXML

Sometimes you want to alter the value of a node or an attribute in an xml document. You can read the XML file using PHP’s SimpleXML to  assign new values to elements or attribute and save the changes back to the file.
<?php
$xml = simplexml_load_file(“data.xml”);
/* Aletr value of a node */

Leave a comment

Filed under SEO

Php Interview Questions and Answers – Part 8

Php Interview Questions and Answers – Part 8
1- Give the syntax of REVOKE commands?
The generic syntax for revoke is as following
REVOKE [rights] on [database] FROM [username@hostname]
Now rights can be:
a) ALL privileges
b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc.
We c…

Leave a comment

Filed under PHP

PHP Interview Questions and Answers – Part 4

1- What is the difference between ereg_replace() and eregi_replace()?
eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.
2- How do I find out the number of parameters passed into function9. ?
func_num_args()…

Leave a comment

Filed under PHP

Php Interview Questions and Answers – Part 3

1- What is the difference between CHAR and VARCHAR data types?
CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, “Hello!” will be stored as “Hello! ” in CHAR(10) column.
VARCHAR is a variable…

Leave a comment

Filed under PHP

Wrapping Text in PHP

Sometimes we need to wrap text to exactly accommodate a certain width of text or allowing browsers to wrap text whenever required. You can use PHP’s wordwrap() function to wrap a string into new lines when it reaches a specific length. This function limits text display to a particular column…

Leave a comment

Filed under PHP

Order Editor tep_add_base_ref AJAX ERROR FIX – osCommerce

Fatal error: Call to undefined function tep_add_base_ref() in /home/XXXX/public_html/XXXX/admin/edit_orders_ajax.php on line 1149

For those who have this problem:add below code to admin/include/function/general.php before closing tag ?>
function tep_add_base_ref($string) {
$i = 0;

Leave a comment

Filed under PHP

Php Interview Questions and Answers – Part 2

1- Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.nHow are you?nThanks for visiting techpreparation’; print $str; ?>
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and…

Leave a comment

Filed under PHP