[PHP] parse error: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
I went with this, but am getting a parse error.

usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à'), array('e', 'a'), $a);
$b = str_replace(array('é', 'à'), array('e', 'a'), $b);
return strcasecmp($a,$b);'));

Anyone see it? I've got headaches from squinting at the monitor.

Thanks,
J

Marek Kilimajer wrote:

usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à', ), array('e', 'a'), $a);
$b = str_replace(array('é', 'à', ), array('e', 'a'), $b);
return strcasecmp($a,$b);'));

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread Marek Kilimajer
I'm sorry, I used unescaped single quotes inside single quoted string, 
this is right:

usort($authors, create_function('$a,$b','
$a = str_replace(array(é, à), array(e, a), $a);
$b = str_replace(array(é, à), array(e, a), $b);
return strcasecmp($a,$b);'));
John Taylor-Johnston wrote:
I went with this, but am getting a parse error.
usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à'), array('e', 'a'), $a);
$b = str_replace(array('é', 'à'), array('e', 'a'), $b);
return strcasecmp($a,$b);'));
Anyone see it? I've got headaches from squinting at the monitor.
Thanks,
J
Marek Kilimajer wrote:

usort($authors, create_function('$a,$b','
  $a = str_replace(array('é', 'à', ), array('e', 'a'), $a);
  $b = str_replace(array('é', 'à', ), array('e', 'a'), $b);
  return strcasecmp($a,$b);'));

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
Sorry. Still getting a parse error on line 40:

39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));

Can you have two arrays there? http://ca2.php.net/manual/en/function.str-replace.php

All the brackets are in the right place. Hmmm ...?

Thanks,
John

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread Miroslav Hudak (php/ml)
Dunno the original question, but this obviously should be escaped...
So the correct code follows...
usort($authors, create_function('$a,$b','
  $a = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $a);
  $b = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $b);
  return strcasecmp($a,$b);'));
Regards,
m.
John Taylor-Johnston wrote:
Sorry. Still getting a parse error on line 40:
39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));
Can you have two arrays there? http://ca2.php.net/manual/en/function.str-replace.php
All the brackets are in the right place. Hmmm ...?
Thanks,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php